Do particles at rest gain energy in an expanding universe? It is commonly understood that as the Universe expands with scale factor $a$ the energy of a photon drops like $1/a$ whereas the energy of a particle at rest is constant.
In the analysis below I attempt to show that these assumptions are incorrect. I show that as the Universe expands the energy of a photon is constant whereas the energy of a particle at rest increases like $a$.
Thus the cosmological redshift is not caused by photon wavelength expanding but rather by absorber atoms acquiring a larger energy than the emitting atoms.
Am I correct?
Update
I think I'm wrong. Thanks to @AndrewSteane I realize that I am calculating the energy component of the $4$-momentum which will be coordinate dependent and therefore unphysical by itself.
Lagrangian mechanics of a particle moving in curved spacetime
The action for a massive point particle moving in curved spacetime is proportional to the integral of the proper time $\tau$ along its worldline:
$$S=\int L[\tau]\ d\tau=-m\int d\tau.\tag{1}$$
An interval of proper time $d\tau$ is given by
$$d\tau^2=-dx^{\nu}dx^\mu g_{\mu\nu}.\tag{2}$$
We can combine Eqn.$(1)$ and Eqn.$(2)$ using the arbitrary parameter $\lambda$ to obtain
$$S=\int L[\lambda,x^\mu(\lambda),\dot{x}^\mu(\lambda)]=-m\int d\lambda\Big(-\frac{dx^\mu}{d\lambda}\frac{dx^\nu}{d\lambda}g_{\mu\nu}\Big)^{1/2}.\tag{3}$$
Now Eqn.$(3)$ is only valid for massive particles. There is an equivalent form of Eqn.$(3)$ that is valid for massless particles as well, which includes the extra field $e(\lambda)$, given by
$$S=\frac{1}{2}\int d\lambda \Big(e^{-1}(\lambda)\frac{dx^\mu}{d\lambda}\frac{dx^\mu}{d\lambda}g_{\mu\nu}-e(\lambda)m^2\Big).\tag{4}$$
The field $e(\lambda)$ is completely fixed by its equation of motion, obtained by setting $\partial L/\partial e=0$, to give
$$\frac{dx^\mu}{d\lambda}\frac{dx^\nu}{d\lambda}g_{\mu\nu}+e^2(\lambda)m^2=0.\tag{5}$$
If you substitute the equation of motion Eqn.$(5)$ into the generalized action Eqn$(4)$ you obtain the original action Eqn.$(3)$.
Now in Lagrangian mechanics the energy can be derived from the Lagrangian using the expression
$$E(\lambda)=-\frac{\partial L}{\partial (d x^0/d\lambda)}.\tag{6}$$
The corresponding Euler-Lagrange equation is given by
$$\frac{d}{d\lambda}\Big(\frac{\partial L}{\partial(d x^0/d\lambda)}\Big)=\frac{\partial L}{\partial x^0}.\tag{7}$$
Particle moving in a FRW universe
I now wish to describe an general expanding FRW universe using conformal time $\eta$ and a homogeneous, isotropic $3$-space with metric $\gamma_{ij}$ and co-ordinates $(u^1,u^2,u^3)$ so that we have
$$g_{\mu\nu}=a^2(\eta)\ \mathrm{diag}[-1,\gamma_{11},\gamma_{22},\gamma_{33}].\tag{8}$$
The interval of proper time $d\tau$ is obtained from Eqn.$(2)$ and Eqn.$(8)$ such that
$$d\tau^2=a^2[d\eta]^2-a^2\gamma_{11}[du^1]^2-a^2\gamma_{22}[du^2]^2-a^2\gamma_{33}[du^3]^2.\tag{9}$$
Substituting the FRW metric in Eqn.$(8)$ into the generalized particle action Eqn.$(4)$ we obtain the Lagrangian given by
$$L=\frac{1}{2}e^{-1}(\lambda)a^2(\eta)\Big(-\Big[\frac{d\eta}{d\lambda}\Big]^2+\gamma_{11}\Big[\frac{d u^1}{d\lambda}\Big]^2+\gamma_{22}\Big[\frac{d u^2}{d\lambda}\Big]^2+\gamma_{33}\Big[\frac{d u^3}{d\lambda}\Big]^2\Big).\tag{10}$$
By combining Eqn.$(6)$ and Eqn.$(7)$, and using the proper time interval $d\tau$ from Eqn.$(9)$, we find that the particle energy $E$ obeys the equation
\begin{eqnarray}
\frac{dE}{d\lambda}&=&-\frac{\partial L}{\partial \eta}\tag{11}\\
&=& e^{-1}(\lambda)a(\eta)\frac{da(\eta)}{d\eta}\Big(\Big[\frac{d\eta}{d\lambda}\Big]^2-\gamma_{11}\Big[\frac{d u^1}{d\lambda}\Big]^2-\gamma_{22}\Big[\frac{d u^2}{d\lambda}\Big]^2-\gamma_{33}\Big[\frac{d u^3}{d\lambda}\Big]^2\Big)\tag{12}\\
&=&e^{-1}(\lambda)\frac{da/d\eta}{a}\Big[\frac{d\tau}{d\lambda}\Big]^2.\tag{13}
\end{eqnarray}
Massless particle
A massless particle travels along a worldline such that $d\tau=0$.
Therefore Eqn.$(13)$ implies that $dE/d\lambda=0$ and so the energy $E$ of a massless particle is constant.
Massive particle at rest
We consider a massive particle at rest ($du^1=du^2=du^3=0$) so that Eqn.$(9)$ implies
$$\frac{d\tau}{d\eta}=a(\eta).\tag{14}$$
Furthermore, by using the definition of the proper time interval in Eqn.$(2)$, the equation of motion Eqn.$(5)$ can be written as
$$\frac{d\tau}{d\lambda}=e(\lambda)m.\tag{15}$$
By substituting for $e^{-1}$ from Eqn.$(15)$ into Eqn.$(13)$ to get Eqn.$(17)$ and substituting Eqn.$(14)$ into Eqn.$(18)$ we get
\begin{eqnarray}
\frac{dE}{d\eta} &=& \frac{dE}{d\lambda}\frac{d\lambda}{d\eta}\tag{16}\\
&=& m\frac{d\lambda}{d\tau}\frac{da}{d\eta}\frac{1}{a}\frac{d\tau}{d\lambda}\frac{d\tau}{d\lambda}\frac{d\lambda}{d\eta}\tag{17}\\
&=& m \frac{da}{d\eta}\frac{1}{a}\frac{d\tau}{d\eta}\tag{18}\\
&=& m \frac{da}{d\eta}.\tag{19}
\end{eqnarray}
By integrating Eqn.$(19)$ we find that for massive particles at rest the energy $E$ is given by
$$E=m\ a(\eta).\tag{20}$$
 A: I present this answer in two sections. The first section gets to the point in a pithy way. The second section then expounds more generally how questions of this kind can be considered.
1. Quick answer
The quantity expressed in eqn (6) of the question is coordinate-dependent. The right hand side is a component of a 4-vector. The eqn might be written more clearly by using $p_0$ rather than $E$ as the symbol on the left hand side. A suitable scalar measure of energy can then be expressed as $E=−p_\mu u^\mu$ where $u^a$ is the four-velocity of the observer who registers (observes) this energy. For the interpretation of this energy, read on.
2. How to assess more generally some proposals to reinterpret effects of cosmological expansion
When the waves of the cosmic background set off on their journey billions of years ago, they had wavelengths around a few microns. This means that if you took some of the hydrogen atoms which were floating around and lined them up next to each other, and compared with the wavelength of the waves, then you would find you could fit of order twenty thousand hydrogen atoms inside one wavelength of the cosmic background radiation.
When the waves arrive here on Earth their typical wavelength is 2mm. Consequently you can now fit about twenty million hydrogen atoms into one
wavelength of the cosmic background radiation.
Whatever your calculation method, it will have to yield predictions which agree with the above if it is to be consistent with the standard physics of gravity, electromagnetic waves and atomic structure.
Now let's interpret the observations in terms of length. We define a standard of length by using an atomic clock and the speed of light. Adopting this standard, we find that atoms stay the same size as cosmic history unfolds. Using this distance measure, the wavelength of the background radiation (and of all other electromagnetic radiation propagating over distances large compared to galaxy clusters) gets longer as the waves propagate from one event to another at some significantly later moment in cosmic history.
The above is how we normally talk about all this. But relativity is called 'relativity' for a reason. You can if you like invoke a measure of time and distance such that, in your adopted coordinate system, ordinary stuff gets smaller in proportion to the scale factor $a$ when size is measured by coordinate values. But measuring size by coordinate values is a misleading thing to do. Better to measure the size of one physical object by comparing it with another physical object. That is what I did in my analysis above.
In the particular example asked about in this question a coordinate-dependent energy measure was proposed. One can do that but then it needs to be interpreted with care.
