Suppose that a piston of nonzero mass encloses an ideal gas in a vertical cylinder. The piston and cylinder are thermally insulated so that no energy is lost by heat transfer to the surroundings. If the piston is set into motion, it oscillates like a block on a spring. However, the motion is damped because the gas density and pressure immediately adjacent to the piston are higher or lower than the bulk values, depending on whether the piston is compressing or expanding the gas, respectively. That automatically gives rise to a drag force linear in the velocity of the piston. It is not necessary to add extra dissipative terms such as kinetic friction between the piston and cylinder, or viscosity of the gas, to damp out the motion of the piston. The ideas should thus be helpful to undergraduate students performing a Ruchardt experiment to measure the ratio of the heat capacities of a gas.