  Rastall introduced a stress-energy tensor whose divergence is proportional to
the gradient of the Ricci scalar. This proposal leads to a change in the form
of the field equations of General Relativity, but it preserves the number of
degrees of freedom. Rastall's field equations can be either interpreted as GR
with a redefined SET, or it can imply different physical consequences inside
the matter sector. We investigate limits under which the Rastall field
equations can be directly derived from an action, in particular from two
$f(R)$-gravity extensions: $f(R,\mathcal L_m)$ and $f(R,T)$. We show that there
are similarities between these theories, but the Rastall SET cannot be fully
recovered from them, apart from certain particular cases here discussed. It is
remarkable that a simple, covariant and invertible redefinition of the SET, as
the one proposed by Rastall, is hard to be directly implemented in the action.
