"In my state, Pennsylvania, it is my understanding that the homeless are not allowed to drive or even to receive mail, because a mailbox cannot be used for the address on their driver's license"
I'm certain you're wrong about both of these assertions, in PA or any other US state. There are federal laws at play, and both of these limitations on homeless people would definitely cross the bounds of federal law. Also, they would be incredibly evil; pretty much designed to keep homeless people homeless.
Mail can be received, by anyone, via general delivery at any post office main branch in a city, and often several other branches, if the city is large. Mail is damned near a constitutional right (federal mail service is one of the few services explicitly permitted by the constitution).
A drivers license is somewhat trickier, since some states do require one to have a "permanent residence" within the state, and don't allow general delivery for that purpose, and some don't even allow PO boxes, though most do. But, Mailboxes Etc. and the like are generally acceptable for this purpose (I use a mail forwarding service for my mailing address for all legal correspondence, including drivers license and taxes). Incoming mail is also one of the services that homeless shelters sometimes provide to their clients, as part of the process of helping them out of homelessness (if you can't drive or get mail in a shithole like rural Pennsylvania, you're SOL when it comes to finding a job, and getting your life back in order). I'll also mention that the federal government, and many states, consider a description of your boat or motorhome as an acceptable "permanent residence" address, as long as a mailing address is also provided.
"Therefore, unless the rules are different in his state, he is not allowed to drive, and if that's the case, then: How can he be a lawful resident?"
So, you reckon I'm an outlaw, flaunting convention and decency?
My residence state is Texas. One of the reasons for that is that it has very relaxed rules about residency, making it more convenient than many states...a forwarding address works fine for all government purposes in Texas. Most states actually want to claim you as a resident, rather than trying to prevent you from becoming one. California, for example, is still trying to convince me to pay income taxes there, even though I haven't been back in a year.
If you google "rv full-timer domicile state" you'll find tons of discussion of the best states for full-timers (South Dakota, Texas, Florida, Wyoming), based on various taxes, convenience and costs of renewing and maintaining licenses and registrations, insurance costs, etc. I chose Texas because I lived there for seventeen years, and I spend two or three months a year there (more than any other state), so Texas is the devil I know and it's ethically probably the one I should be voting in and paying taxes in. But, I considered all the others, and if Texas proves to be ornery for any reason, I won't hesitate to "move" to South Dakota or Florida.