FWIW, it's entirely up to the dealer. The law is only a guideline for a legal transaction.
If the dealer doesn't want to deal with the BS associated with a questionable residency, he's under no obligation to sell you a gun.
For many shops, including mine, the paperwork and potential problems associated with a questionable transaction, just are not worth the headaches for the small profit on a gun sale.
Also FWIW, there is no requirement to surrender an out of state drivers license in order to obtain a PA ID card.
http://www.dmv.state.pa.us/driverLicensePhotoIDCenter/obtainingPhotoID.shtml
Any Joe Bumblefuck can get an ID card.
This is why I will not sell to out of staters... period.
I've had too many NY residents come in my shop with a PA ID card claiming to be PA residents. Funny thing is, they still have a NY drivers license in their wallet... or sometimes NO drivers license at all... When questioned how they got to my shop, they always lie... saying: "Oh, I didn't drive." (After I just saw them get out of the car on my security cameras.)