The powder burning pushes the bullet forward and the rifle backwards. Sir Newton made sure of that, can't have one without the other. When the still expanding gases reach the atmosphere there is a brief instant when the gases are trying to push the atmosphere out of the way and there is another recoil impulse from the rocket effect. This can harnessed be rapidly stopping the gases with a moderator or forcing them to turn an abrupt corner in a muzzle brake. If Newton was still around and was a shooter he'd have another law about brakes turning gunpowder into noise.