# Why doesn't photon lose energy over distance?

In an atom, ( or even an oscillating circuit) When an electron falls from higher energy level to a lower one, it gives a photon of energy $hf$. On other hand it can be considered as an accelerated-decelerated charged particle that make an electromagnetic radiation which moves vertical to the path of acceleration. But in first explanation we have a photon that goes into the vacuum and does not lose energy over distance but in latter explanation we have an electromagnetic wave that diminishes by the ratio of $1/r^2$.
How do you interpret this discrepancy? I am sure I am making a mistake somewhere.

A classical electromagnetic wave can be thought of as a very large number of photons. The energy carried by the wave is then given by the number of photons multiplied by the energy per photon (assuming a monochromatic source for simplicity). As the photons travel, simply by geometry the number of photons per unit area will decrease as $\frac {1}{r^2}$, while the energy per photon is unchanged. So the energy per unit area in the wave decreases as $\frac {1}{r^2}$.