We show that Kompaneetz equation describing photon diffusion in an environment of an electron gas, when linearized around its equilibrium distribution, coincides with the relativistic diffusion discussed in recent publications. The model of the relativistic diffusion is related to soluble models of imaginary time quantum mechanics. We suggest some nonlinear generalizations of the relativistic diffusion equation and their astrophysical applications (in particular to the Sunyaev–Zeldovich effect).