Importance Sampling in Off-policy n-step Sarsa
It seems like someone else asked themselves the same question on Cross Validated. It makes sense for the ratio to be multiplied to G only, since it's only G that uses the behavior policy to sample the next n rewards.