One reason is simple economics: there's no perfect substitute for a specific book. If I want the next book by my favorite author, buying another book with a similar looking cover won't really do it. So price wars aren't as competitive as they are in, say, the grocery store.
But the bigger reason is that it costs a lot to produce quality books at scale.
First a publisher has to decide to make the investment. This means an editorial assistant or intern needs to read hundreds of manuscripts. Agents will read thousands of queries and hundreds of books to find one that they will actually publish. The actual editors will ready ten or twenty books for each one that they want to make an offer on--and then usually not end up with the winning bid. Which means starting over and looking for another book.
Don't forget that when an editor is trying to acquire a book, she has to consult with marketing, sales, and other groups in the company who will judge how well they will be able to support the book. To get a few good books, they have to run through this process many times. Don't forget that contracts need legal review and an accountant need to make sure that the author is paid.
Once a book is acquired by a publisher, the editor takes it through several revisions, which will usually substantially alter it. In this stage a book may suddenly become very emotionally compelling or gripping--in ways that a casual reader wouldn't have predicted. Or maybe it will lose a boring introduction that would have turned readers off before they got to the good parts.
Once a book is edited, it needs to be typeset and copyedited, which means a lot more reading by a few more people. Also, it needs a cover design, and possibly interior art, which needs not only to be created but art directed. And legal may need to review it if there are usages of brand names or other potential issues.
At this point, we actually have a book. It looks like a book, it reads like a book, and it could now realistically be tested against a target market. There's no such thing as a minimum viable product for a book. I'd like to see a more scientific, testing-based approach in publishing, but often the book doesn't come together into a hit-worthy package until you've done the work to take it all the way. You might have ten books with hit potential, but only one of them comes out of this process having fulfilled its potential.
Now, someone needs to put the book out and actually market it. This means a publicity person needs to get the word out to the press, and marketers who buy ads and run campaigns. In the modern world, someone needs to be on facebook and twitter. Often this is the author, but it's still adding to the amount of work that went into the book. The author will probably also be touring around in meatspace, possibly paid for by the publisher and possibly not, but that money is coming from the consumers no matter what.
The book files will need to be archived and corrected for future editions, and someone will need to manage the financial relationship with the author as the book is published across print editions and various ebook retailers, each with its own quirks and process.
And speaking of ebook retailers, they need to get paid to! Their 30% has to cover all the costs of running their operation, which may include subsidizing ereader devices and all the costs of negotiating with both the big publishers and the hundreds of little ones.
Even after this painstaking process, many books will fail. A bunch will barely earn back their investment. The regular-sized hits will keep the business afloat, and the mega-hits will make it worth being in the business in the first place.
It's really hard to predict whether people will like your final product until you put that final product out into the marketplace. For entertainment products this is especially true, because a little bit of polish makes a huge difference. I'm sure I've missed things, but keep in mind that the cost of printing and shipping most books is less than $2 for a hardcover, less than $1 for a paperback.
Is there a better way to do this? Of course there is. But it isn't here yet, and it's a lot harder than you think (but I highly encourage you to try!). Someday, someone will figure out how to crowdsource a lot of this or turn it into a scientific numbers-driven process, but early experiments have not made a lot of progress.
tl;dr Producing good books at scale is expensive and requires creating a lot of not-so-good books as a side product. The physical manufacture has never been the main cost driver.