As long as the PIC gives permission, it's allowed (IE, if you are PIC, you can allow yourself). As far as when you are on the ground, the laws might apply differently, but in flight it's PIC descretion. Outside the aircraft you'd need a permit or have the gun secured, as required by local law (make sure you know what that means where you are going, it might need to be unloaded in a locked case in some areas).
In AK, it's not unusual to see a supercub with a hardsided gun case like you mount on a 4wheeler strapped to the wing strut. It also used to be state law that the PIC was REQUIRED to carry a firearm. They only repealed that law because it led to problems if you were flying from the lower 48 since you'd likely be wanting to make a stop in Canada.