I have a theory about this. Which is that the upper/upper-mid class in particular cares more about the image of a pristine library than they do the actual effectiveness/reach of that library. This theory shows itself quite a lot through how people talk about libraries: not in how many students find what they're looking for, how happy librarians are, how many grades or careers have been improved. It's bathrooms and walls.
Small college towns have a couple of real advantages over big cities in this regard. First, they're small, which helps a lot. Second, they tend to have more funding available per-capita than large cities do.
Also in the burbs, it's not a trivial task for homeless to even get to a place like the library, where in NYC it's pretty easy to get around.
I still use the library in NYC, but I agree that some locations aren't exactly great places to spend the day studying, but it very much depends on the branch. "unusable" feels like a stretch. I can still pickup books and get help from librarians if I need it.
Somehow I doubt that all of the branch libraries of those systems are "homeless shelters." More likely the it's just the larger libraries near the actual shelters. Where "the average taxpayer" wouldn't spend time anyway.
I was astounded to find that the small east-coast college town where I now live has a clean, bright, pleasant library that serves as a community educational space for all (not just the homeless or teenagers.) The bathrooms are usually spotless.
I wonder: how have massive cities like LA and NYC allowed their libraries defacto homeless shelters? It's a shame that public libraries in these cities are essentially unusable to the average taxpayer.