Basic physics. Newton's First Law. Only the velocity of the powder mass depends on pressure at the muzzle, anywhere from 5500 ft/sec for a high powered rifle to 3000 ft/sec for a pistol.
Note, the product of the mass and velocity of the powder and bullet must equal the product of the mass of the firearm and its free recoil velocity. Knowing this free recoil velocity, one can determine free recoil energy.