I can think of some methods of doing it, but doubtless I cannot think of them all! Perhaps you can add to my list. Some techniques may be more accurate than others, and some may be harder than others to carry out.
1) Put the gas in a closed container and weigh it on a scale. There are two things to be careful about here -- one is the weight of the container and the other is the buoyant force arising from the fact that the container with the gas in it is being weighed with air all around. Buoyant forces are strong when the environment is water, but they can be noticeable in air, particularly when trying to weigh gases. For example, a very light, thin container of helium may float away off of the scale. Helium doesn't have a negative weight or density, it just has a density less than that of the surrounding air. The buoyant force is the weight of the air that's displaced by the container. By weighing a container full of gas, you are measuring the weight of the gas plus the weight of the container minus the buoyant force. You can then fill the container with air and weigh it. The weight of the container and the buoyant force will be the same, and the difference in the weights will be the difference between the weight of the gas and the weight of the air. You'll have to look up the density of air somewhere or weigh it in a different way. Alternatively, if you have two identical containers, one which you can put a good vacuum in and the other which you can fill with gas, you can put them on a balance and add extra mass to one side of the balance until it balances. This extra mass will be the same as the mass of the gas.
2) If you know what the composition of the gas is, you can look its density up in a table somewhere and measure its volume. Multiplying density by volume gives mass.
3) Ball-in-tube flowmeters really are mass flow meters. Gas will flow through a vertical tube which has a slight taper from the top to the bottom (smaller on the bottom, larger on top). A little steel ball sits in the tube. As the gas flows by, it pushes the ball up. The tube is marked off in grams per second. By flowing the gas through such a device at a constant rate, measuring the flow rate in grams/sec and multiplying it by the time it takes for the gas to flow by, gives the mass of the gas.
(n.b. -- this probably doesn't work well for viscous gases, or ones that corrode the tube or the ball).
4) You could try dissolving the gas in water and measure the mass of the water on a scale or balance before and after dissolving it. Be careful about evaporation, though!
5) You can freeze the gas and put the frozen gas on a scale or balance. This only works well for some gases, like carbon dioxide, which freeze solid at temperatures which do not take too much money to attain. Nitrogen liquefies nicely, and the Physics Van uses liquid nitrogen in its demos.
6) Perhaps the most precise way I can think of right off the top of my head for measuring the density of a gas is to measure the speed of sound in it. You also have to measure its compressibility. The speed of sound in a gas is sqrt(compressibility/density), where the compressibility is how much the volume changes when the pressure changes, without any heat exchange with the environment. If the gas is placed in a tube, the length of the tube and the speed of sound in the tube determine the resonant frequencies of sound in the tube, which can be measured very very precisely. Once one uses these things to measure the density of the gas, then measuring the volume of the gas gives its mass. Of course if you can look up the density, then method 2) is much easier than doing this.
(published on 10/22/2007)