This is the example Wikipedia used fwiw
if there are runners on base and a batter hits a foul fly ball that is dropped, and then bats in the runners on base through a base hit (including a home run), the runs are unearned for the time being, as the runners should not have advanced. If the results of the remaining at-bats in the inning would not have scored the runners, the runs remain unearned. However, if results of subsequent at-bats would have scored the runs anyway, the runs would count as earned, unless they only would have scored as a result of a subsequent error or passed ball.