I think this is the mindset required for this conversation. There is no way to make a library drive a profit, let alone financially self-sufficient. However, the library exists because the city values the externalities, specifically an educated public and reduced crime. For those purposes, libraries are incredibly cost efficient.
The same argument can be made for public grocers. Reducing poverty has cascading effects including better health and lower crime rates.