Anna did a lot worse than her good friend Lucy on the test because *she* had studied so hard.

Do "Lucy" and "she" have the same meaning?
yes