Maths question on mean squared error being dervied to bias and variance
Because it's a costant, everything that is a costant value remains unchanged by the E, that's why you can "move" it outside.

For example:



If y is a costant or it is known, the E doesn't affect it, so you can "move" it outside the symbol, and write just y.

The only thing that is unknown is the estimator yhat, in fact you have  and not just .

That's what's happening here.

I found this on CrossValidated that might be more clear.