Which is something I argue against constantly (and at least my local library tries hard not to) --- discarded books are placed on tables near the children's area usually and folks are free to pick them up (it might be that a few of them are sold, I certainly get a lot of ex-library books when buying on Thriftbooks and Better World Books).
A partial solution there is of course a larger budget and a "last copy" policy where the last copy of a text at least is stored away in deep storage against a future loan.
The local libraries also accept book donations for an annual fund-raising sale.