Materials with properties that are modulated in time are known to display wave phenomena showing energy increasing with time, with the rate mediated by the modulation. Until now there has been no accounting for material dissipation, which clearly counteracts energy growth. This paper provides an exact expression for the amplitude of elastic or acoustic waves propagating in lossy materials with properties that are periodically modulated in time. It is found that these materials can support a special propagation regime in which waves travel at constant amplitude, with temporal modulation compensating for the normal energy dissipation. We derive a general condition under which amplification due to time-dependent properties offsets the material dissipation. This identity relates band-gap properties associated with the temporal modulation and the average of the viscosity coefficient, thereby providing a simple recipe for the design of loss-compensated mechanical metamaterials.