The publishing houses.
This has been discussed many times before, and some people will come along with a long list of other products that come with prices printed on them.
My memory is that publishers started to put prices on their books in imitation of magazines doing so first.
Magazines have an obvious need for the price to be immediately obvious, to distinguish the prices of a huge variety of broadly dissimilar products gathered together under the rubric of magazines, and vendors had no interest in investing the time to individually determine a price for them. Grocery stores or department stores had to invest in huge personnel costs - in time and money - to get their products marked. Magazine vendors were small businesses who wanted to move the product through their hands with great speed while they concentrated on higher profit-margin items.
Books did not normally come with prices attached through the 19th century. Booksellers also had comparatively tiny stocks and fairly low turnover, so they could maintain pricing for their entire stocks from lists sent out by the publisher. But two things happened in the early 20th century. The number of books published increased rapidly and bookstores got much larger and more commercial. This was the era of the gaudy superstores of the day, mostly maintained by publishers - Doubleday, etc. And books also started to sport book jackets. This were mere tissue paper protectors at first but soon transformed into the dust jacket of today, with pictorial coves, blurbs, bios of the authors etc. It was easy to put prices on the dust jacket. And very convenient for the stores for the publishers to do so.
This also meant that when books were sold outside of the refined interiors of the grand book stores and book emporiums in the department stores they still had a constant price. Discount prices on particular books were a later development. Discount books soon came along, though: cheaper dollar editions instead of the standard two dollar trade hardback. These were all hardback, but when Pocket Books stole the concept of the paperback from England’s Penguin Books, the Americans made sure that everybody knew that paperbacks were 25 cents flat price. The price became synonymous with the product.
Another explosion in number of books published took place after WWII, with books found in a million unlikely places, none of which wanted to do with the original problem of having to mark each book as it came in. So prices stayed on.
Except for book club books, which collectors can (almost) always tell from the regular trade editions by their lack of prices. You got these through the mail from a catalog giving you the price before you saw the book, so a printed price wasn’t necessary. Selling strategy is hugely important in how a sale goes through between buyer and customer.
Today you can find a growing minority of books with no prices. These are often print on demand books or small press books of various sorts. They may be selling to you through a web site, making the sale the equivalent of a book club’s catalog, or by printing off a few at a time for stores, so that prices may change over the life of the edition. Until technology truly disrupts the current sales mechanisms, books will have prices because both seller and buyer are now accustomed to seeing them, no matter that price discounts are almost inevitable.
It was a rational development to best serve the publishers, the vendors and the buyers. And it sure made figuring out vendor costs, publisher net profits and author royalties (based on cover price) a whole lot easier with standard numbers all around.