When buying books, there are two expenses that lurk in the background yet as buyers, we tend to be unaware of. When managing a bookstore, shelf space is at a premium, while as a publisher, shipping expenses take up a good chunk of your finances.
The beauty of the Internet is that there's the illusion of space although it's really several hard drives/servers linked together. That's not the case with physical bookstores where the books you're selling should be in the store itself, while excess stock might be in a small warehouse "at the back". However, when you have too much variety of books, you can only showcase so many of them on the shelves. Worse, some will even be competing for position--books that are in the front tend to get noticed than those on the back (that's why if you paid close attention to the launch of Harry Potter and the Deathly Hallows last week, the bookstore placed the Harry Potter books in front, to scream to passersby "buy me!"). And in several ways, that's also why the New Releases section is usually in front of the bookstore--they want to get rid of it as soon as possible and give it exposure while it's new. There'll eventually come a time though when a bookstore isn't selling enough books to make space for new ones. Of course chances are, the bookstore's management is thinking that hey, if these books weren't selling last year, they probably won't get bought this year, at least not at retail price. So one of three things happen: either the bookstore sells them at a discount (this is where book sales come in), returns them to the publisher, or sells them to another establishment at a discount, such as a secondhand bookstore (this is sometimes in conjunction with one of the other two options).
Selling books at a discount is a no-brainer. It's to recoup cost and to make space available for the newer books. However, at the end of the sale, not all of the books will be sold. It can either go to the bookstore's warehouse (taking up space), return them to the publisher (if still possible), or sell them somewhere else (i.e. secondhand bookstores).
Returning books to the publisher can be tricky. This is where shipping comes in. Shipping books costs time and money. It becomes even tricker when shipping is charging you by the weight or the volume. Take it from the point of view of the publisher: when I'm delivering books to a bookstore, it's costing me money. Of course I'll expect I'll earn some money from that endeavor. Now bookstore comes calling and they're telling me they can't sell these books. To maintain my publisher cred (or if I'm consigning), I have to take them back. Of course at the back of my mind, I'm thinking that these are books which don't give me profit--they're unsold after all. Worse, I have to pay the shipping costs again. So in many ways, that's a double whammy for publishers. Not only did I lose a possible revenue source, I have to spend more money just to have it "returned" to me. And shipping can be expensive. So what some big publishers do is that they ask the bookstore to "destroy" the book. This usually comes in one of two ways. One, they rip off the covers. The covers are then delivered to the publisher and marked as destroyed (it's cheaper to mail the covers instead of the whole book after all). At this point, technically, it becomes illegal to sell those books without covers. The second is to mark the books in some way, such as a black mark on the front or back page, a sign that it's a surplus stock or some thing. End of discussion, right?
These "destroyed" books however are some of the books that make its way to the secondhand book market. It's not necessarily revenue the publisher would have gotten, but it's a concealed income stream as the ones who profited from the endeavor are the bookstores (who sold it to the subsequent entity) and the secondhand bookstores (who re-sell them to consumers). So as far as publishers are concerned, the system is quite flawed. (Of course in order for this mechanism to work, the publisher must have shipped huge quantities of books to the bookstore. Unfortunately, the local publishing industry doesn't ship that many books or if they do, they're books that the bookstore is confident they can sell. So many local books get returned to the publisher as a whole and not you know, just hollow covers.)
Online bookstores seemed to have solved this problem. Amazon.com doesn't have an actual shelf to display the books that they can possibly order, but they do have a virtual one. Better yet, when they do stock books in their warehouse, it's a warehouse and doesn't need the ambiance most modern bookstores have, even if it's something as simple as a wooden shelf or couches. Second, on the side of the publishers, they only need to deliver books that Amazon.com orders, and that's usually an amount the latter is confident they can sell. Less returns means less redundant shipping expenses.
That's not to say an online model is perfect. Amazon.com is a success story, yet a few years ago, the reports were that their profits were only enough to break even. The imperfect model of buying from physical bookstores may be inefficient, but so far it's still the best way to sell books.