The least action principle played a central role in the development of modern physics. A major drawback of the principle is that its applicability is limited to holonomic constraints. In the present work, we investigate the energy lost by particles as a result of the gravitational interaction in a homogeneous low-density medium subject to non-holonomic constraints. We perform the calculation for an arbitrary particle and outline the specific result for photons. The energy lost is calculated from first principles based on the principle of virtual work and the d’Alembert principle. Under the formalism mentioned above, the dissipative nature of the effect is established. Furthermore, we show that the results agree with an alternative derivation based on continuum mechanics and the Euler–Cauchy stress principle.