The subscript just indicates over which variable the expectation is taken. For consistency it can be included everywhere. Sometimes, when the variable over which the expectation is taken is obvious, it is not precised. For example $E[x]$. In that case it's clear, however you can imagine, that the variable x is dependent on some latent feature and the expectation is not over the variable x, but its latent dependence, e.g. $E_z[x(z)] = E_z[x]$.
Regarding your case, I would assume, that in first case its emphasised that the expectation is taken over all the actions following the policy $\pi$. In the second case, you can conclude from the context, what is the variable of interest is.
You can find very similar question here. Hope it helps!