In some libraries you pay an annual membership fee, not dissimilar to the flat monthly fee paid to Netflix (and now Oyster), as opposed to the per-rental fee Blockbuster used to charge.
Where? Is it for some sort of "premium" access? Otherwise, that's what tax dollars go towards.
There are such things as private libraries (here's one in SF: http://www.milibrary.org/), and public libraries in other countries have different policies.
Municipal libraries often allow non-resident access for an annual membership fee.
University libraries are funded by tuition, and may allow non-university access for a fee.
Free unless you pay property and/or local sales taxes.