As for books that haven't fallen apart from being used as intended and merely are no longer desired, my local library generally sells them off at bargain prices.
What happens when the books don't sell?
They are thrown away, which has been happening since forever, and nobody ever gave a fuck until AI got involved.
Our local library-connected biannual book sale puts a large dumpster, about the size of an 18-wheel truck trailer, outside the warehouse where the sale is conducted. At the end of the sale it gets filled to the brim with waste inked cellulose, and sits there open in the weather until it's taken away for disposal.