A particularly simple relation of proportionality between internal energy and pressure holds for scale-invariant thermodynamic systems (with Hamiltonians homogeneous functions of the coordinates), including classical and quantum – Bose and Fermi – ideal gases. One can quantify the deviation from such a relation by introducing the internal energy shift as the difference between the internal energy of the system and the corresponding value for scale-invariant (including ideal) gases. After discussing some general thermodynamic properties associated with the scale-invariance, we provide criteria for which the internal energy shift density of an imperfect (classical or quantum) gas is a bounded function of temperature. We then study the internal energy shift and deviations from the energy–pressure proportionality in low-dimensional models of gases interpolating between the ideal Bose and the ideal Fermi gases, focusing on the Lieb–Liniger model in 1d and on the anyonic gas in 2d. In 1d the internal energy shift is determined from the thermodynamic Bethe ansatz integral equations and an explicit relation for it is given at high temperature. Our results show that the internal energy shift is positive, it vanishes in the two limits of zero and infinite coupling (respectively the ideal Bose and the Tonks–Girardeau gas) and it has a maximum at a finite, temperature-depending, value of the coupling. Remarkably, at fixed coupling the energy shift density saturates to a finite value for infinite temperature. In 2d we consider systems of Abelian anyons and non-Abelian Chern–Simons particles: as it can be seen also directly from a study of the virial coefficients, in the usually considered hard-core limit the internal energy shift vanishes and the energy is just proportional to the pressure, with the proportionality constant being simply the area of the system. Soft-core boundary conditions at coincident points for the two-body wavefunction introduce a length scale, and induce a non-vanishing internal energy shift: the soft-core thermodynamics is considered in the dilute regime for both the families of anyonic models and in that limit we can show that the energy–pressure ratio does not match the area of the system, opposed to what happens for hard-core (and in particular 2d Bose and Fermi) ideal anyonic gases.