I can walk into a library, pull a book from a shelf, sit down, and read it front to back. No library card needed. Only need one to take a book home. Completely different scenario.
Edit:clarification
Edit:clarification
If thousands of robots suddenly showed up at your local library and started hogging all the books so nobody else could use the library, you can be sure a library card would be required to even enter.
2. I don't know the laws of your jurisdiction, but banning a whole group of people from a public place would, by definition, not make it a public place.
3. The overwhelming majority of librarians view libraries as a service for everyone, including the homeless[0].
[0]: https://www.ala.org/sites/default/files/aboutala/content/olo...