Why does $\mathcal L = -\frac14 F^{\mu\nu} F_{\mu\nu}$ imply Photons are massless? The Lagrangian $\mathcal L = -\frac14 F^{\mu\nu} F_{\mu\nu}$ with $F_{\mu\nu} = \partial_\mu A_\nu - \partial_\nu A_\mu$ results in the four-potential's equation of motion
$$ \underbrace{\partial^\mu \partial_\mu}_{\equiv \square} A^\nu - \partial^\nu\partial_\mu A^\mu = 0\quad(1)$$
which for the Lorentz-gauge $\partial_\mu A^\mu=0$ yields the classical wave equation
$$ \square A^\nu = 0\quad(2)$$
Since $\square = -\hat P^2$ the Lorentz-gauged field must be massless field due to Wigner's Classification. However Physics should be gauge-invariant, while the additional degree of freedom of a gauge transformation $A^\mu \to A^\mu + \partial^\mu\phi$ allows for an arbitrary scalar gauge field for which $(1)$ does not imply any restriction on $\square\partial^\mu\phi$. Especially, $\square\partial^\mu\phi = -m^2\partial^\mu\phi$, i.e. a massive gauge boson, seems possible, rendering the vector field itself massive. While there is no physical interaction, this still seems quite odd, so how can this be fixed?
 A: It turns out that the operator $\square\delta_\mu^\nu - \partial^\nu\partial_\mu$ which acts upon $A^\mu$ in $(1)$ is (up to a factor of -2) the squared Pauli-Lubanski Pseudovector (see e.g. here in the solutions to exercise 2) $W^2$ ($W_\mu = \frac12\epsilon_{\mu\nu\rho\sigma}P^\nu M^{\rho\sigma}$ where the boson representation of the Lorentz generators $M^{\rho\sigma}$ has to be chosen since we're acting on a vector field), i.e. we have
$$(1) (\Leftrightarrow W^2)^\mu_{\ \nu} A^\nu = 0$$
The Eigenvalues of $W^2$ are $-m^2 s(s+1)$, where $s$ is the particle spin. As the linked exercise also shows, $s=0$ results in a longitudinal solution $A^\mu = \lambda p^\mu$ that can be massive, while $s=1$ yields transversal solutions that must be massless.
Now Wigner's Classification can be used again to argue that the longitudinal massive scalar boson is an entirely different particle, which as the question already showed is the gauge boson. While even in the interacting case $\mathcal L_\text{QED} = -\frac14 F^{\mu\nu}F_{\mu\nu} + \bar\psi (iD\!\!\!\!/-m)\psi$, yielding $(W^2)^\mu_{\ \nu} A^\nu = -\frac12 j^\mu$, the gauge boson doesn't interact, it's potential (though seemingly boring since non-interacting) presence does not appear to be deniable. This would of course be pretty relevant in a GR-QED...
A: The variable $\phi$ in your notation is the $U(1)$ gauge parameter. It's no coincidence that the equations of motion imply no restriction on $\phi$; that's exactly why we say that $\phi$ is a parameter labeling a symmetry (gauge symmetry in this case). Every configuration of $\phi$ (or configuration of $A_\mu$ that's calculated from such a $\phi$) is as good (=and as compatible with the equations of motion) as any other.
And it follows that $\phi$ cannot produce physical degrees of freedom, observable fields: if $\phi(x,y,z,t)$ may depend on $t$ arbitrarily, without any restriction dictated by the equations of motion, it implies that it can describe no field or particle that evolves according to the initial conditions. In other words, $\phi$ is a completely unphysical degree of freedom. The corresponding potential is "pure gauge". When you introduce the quanta of $\phi$ anyway, you will find out that they decouple: the probability of producing them from physically allowed particle modes is zero. The true physical configuration space is a quotient in which all the configurations related by gauge transformations – i.e. by a change of $\phi$ only – are identified with each other. We say that gauge symmetries aren't real symmetries; they are redundancies.
To derive that there is a massive particle, you would actually have to find a field $\Phi$ for which you would be able to prove that $(\Box+m^2)\Phi=0$ does follow from the equations of motion. If no equation like that follows from the equations of motion – and obviously, the Maxwell action has no dimensionful mass parameter, so one simply can't arise from the equations of motion – it proves that there can't be any physical massive excitations, at least not perturbative ones.
