It's generally legal to purchase a long gun outside your state of residence, provided that:
1) Purchasing out of state is not illegal in your state;
2) Selling to out-of-state residents is not illegal in the state where you'd like to purchase, and;
3) You purchase in person from a licensed dealer at that dealer's premises or at an organized gunshow in the dealer's state.
So, unless NJ or PA law forbids it, you can purchase a long gun from a dealer at the Valley Forge show, but cannot purchase a handgun there, nor purchase any firearm from an unlicensed seller.