Theoretically, if we say the gas have a mass of X, and the bullet has a mass of Y, if the gases transfer kinetic energy to the system of Y in an inelastic collision, through the laws of conservation of energy and momentum, Y and X will become a system of Y + X. So, if the mass of X is, say, 2 grams (as in the powder of a .223 round) and the mass of the round is say, 4 grams, then the velocity of 2 grams of powder would be, say, 2820 m/s, and then that velocity and energy would transfer to the four gram bullet, creating the system (X + Y), or 6 grams, reducing the velocity of the system to roughly 940 m/s.

If you notice, nitroglycerin mixed with nitrocellulose and wax would probably be around 5640 m/s, while the bullet velocity is around 940 m/s, what you find in a 5.56mm round.

So, when the bullet leaves the barrel, some of those expanding gases (1-2 grams) is sent back into the weapon to press on the bolt or a piston, and because the gases are sent backwards into the weapon, they counter act the backwards recoil with enough force to reduce some of the recoil.