A librarian friend explained to me that books they distribute need generally need some extra tagging, bar coding, perhaps cover wrapping to make them more durable, etc. Libraries also curate their collections because they only have so much shelf space.
For a library the money from selling donated books is more valuable than a bunch of (more often than not) filler that'd need to be prepped for loaning (the barcoding, etc) and sorting through to see if they are worth adding to the collection. That money can then be used for books or other library programming.
(Not to mention the awful state some donated books are in... Missing pages, all sorts of things inside of them... Porn stored inside... Wrong covers because of people pulling things... Imagine having to flip through every book to check them out prior to doing all the other prep. It's far simpler to acquire the books from known sources.)
For a library the money from selling donated books is more valuable than a bunch of (more often than not) filler that'd need to be prepped for loaning (the barcoding, etc) and sorting through to see if they are worth adding to the collection. That money can then be used for books or other library programming.
(Not to mention the awful state some donated books are in... Missing pages, all sorts of things inside of them... Porn stored inside... Wrong covers because of people pulling things... Imagine having to flip through every book to check them out prior to doing all the other prep. It's far simpler to acquire the books from known sources.)