It was only because libraries were made 120 years ago BY billionaires of their time (Carnegie, etc), and was a a way for those billionaires to sanitize their history of abuse by philanthropy.
On the reverse, we have Annas Archive, Library Genesis, Sci-Hub, Archive.org and others. Made by average non-billionaire humans sharing knowledge in the largest free libraries. Except they're demonized and criminalized.
There really isnt a difference at all with physical in person library, and an online free library. And using a phone camera, is also trivial to copy a book within a span of 10 minutes. You dont even need to borrow it - just sit in a carousel and scan scan scan.