You can always sell those books on Amazon (I've seen libraries do it) but it basically requires a full time team to handle listings, sales, shipping, returns, etc.
Libraries aren't museums. They are for use by people who want to read books.
It took me a while to internalize this other rule: the median resale of used books is zero dollars. Once upon a time each physical copy of a book was a very rare item that represented hours of physical labor. These days it costs money to get rid of old books.
No one is waiting to read my old books.[1] They have sentimental value to me, but when I die the best I can hope for is that my kids get them into the recycle bin instead of the landfill.
[1] (Well, I have some of the original Wild Cards novels which are apparently out-of-print.)
There's value in preserving things, but some books are really really bad. I call those "Write only" books. You'll find tons of them if you browse the stack of any random library. It always makes me wonder about the author - does he realize no one at all will read his book?
I understand the need to get rid of unwanted books from a library; books are ming in, so naturally some books have to go out. What I find despicable is destroying those books rather than trying to find ways to people who would use them.