This sucks but was inevitable. Libraries are such a weird and wonderful thing. Even though books are widely sold, there’s a place where you can go and read them for free instead. And it’s not some weird loophole, it’s a basic unit of our society and an assumed part of every community. Unfortunately this is America. Nothing can beat out profit motives forever. The libraries really never stood a chance.
Libraries now exist more as a place for community: somewhere quiet anyone can freely hang out, access resources like 3D printers (or for the very poor, public fountains/restrooms and the internet), and attend workshops. Some libraries like the Boston Public Library are still nice and active even today (https://www.bpl.org/). But unfortunately as you mentioned, people today really don't fund community, and there are a lot of degrading and closing libraries.