Three basic tenets of classical physics are the conservation of energy, the conservation of mass and the conservation of momentum. All of those principles play into the calculation of recoil energy.

The sum total of all the energy in the universe, kinetic and potential (stored) is constant. Energy can be converted from one form to another; in this case potential chemical energy becomes kinetic energy via heat and light (solid, liquid and gas) but it never ceases to exist.

Likewise, mass can neither be created nor detroyed.
In this case, the 20 or so grains of solid propellant (of a certain chemical composition including some liquid moisture) is converted to the products of combustion...a small amount of solids and liquids , but mostly gas. The sum of the masses of all those products is exactly the same as the mass of the powder charge, and most of it is ejected. So, yes, though a small contributor to the total, the mass of the solid powder was converted to a simialr mass of (mostly) gas and was ejected.