It's true that
public libraries do often require proof that you live in the community they serve -- the community that pays the bills, to put it bluntly.
But there's often a way around this. First, if you have a library card from a neighboring library district, you may be able to get a card at other libraries. There's often a reciprocal agreement among the public libraries in an area to let each other's patrons use any convenient library.
Academic libraries sometimes have the same kind of agreement with each other. For example, when I was on the Princeton campus years ago, I found that I could show a University of Florida student ID and be admitted to the library without paying for a two-week pass. The two libraries were 1000 miles away, and yet they provide this academic courtesy to each other.
Depending on the kind of university, you may also be able to apply for a library card even if you're not a student. Community college and public university libraries often serve the public as well as the campus, although you may have to pay a fee if you aren't otherwise affiliated with the school in question. You might also need to explain that you are an independent scholar and that you're working on a specific project.
If all else fails, ask your public library how to request items by interlibrary loan. Libraries will loan each other materials to check out to their patrons, and your library's staff can find a willing lender so they can, in turn, loan the book to you. Use this as a last resort, since it involves paperwork all over, but do use it if you need to.