My local municipal library has gone back and forth. It is on land which is technically Parks & Rec jurisdiction, and so it's patrolled by uniformed Park Rangers. There are strict rules about bathroom use and there is technically no sleeping allowed inside the library. During the lockdowns, of course, they were able to keep out the riffraff by mandating masks and doing curbside, online-facilitated book pickups.
But the whole neighborhood by the library is a mass of homeless hangout, especially the bus stops right nearby, and let me tell you, it's downright scary when bus stops are "owned" and squatted by a group of creeps who are drunk and/or on drugs and/or bent on violence. There is literally nowhere safe to sit in the shade and wait for an actual bus, because nobody at the stop intends to get on the bus at all. And, when you do board a bus, especially the free-fare ones, it's clogged with the same types of weirdos going to/from their daytime hangouts.
Personally for me, when I was homeless, libraries were a life saver, and I definitely hung out at libraries, which kept me (1) out of trouble, (2) safe from the weather, (3) connected to friends and family, and (4) occupied and not bored, and (5) no need to spend money. Of course, I was extremely careful about obeying all rules and regulations and not being caught out as homeless. Sleeping was mostly OK, and I didn't need to shower, shave, or brush teeth in the bathrooms, so that also helped.
So all these creature comforts and amenities attract people of lower economic class. Often it's really nice to use a lab computer, set your phone down while it's charging, get on the Internet and do some job searches. If there's a café in your library, then you can stay all day without leaving.
Even people who do have homes may prefer the library during the day. If they have obnoxious roommates, abusive family members, no A/C or heating, whatever, they can come to the library and enjoy all that, courtesy of the taxpayers.
Thanks neoliberals.