A slightly less (or perhaps more) confusing explanation
Let's just assume that your internal marks were 88 and 87.
a) You do crap (75 exam mark) and she does well (90 exam mark)
Since she came first, the person who beat you gets the top exam mark (hers, probably) as her moderated assessment mark, and keeps her exam mark as her own, resulting in 90 90 | 90 for her overall HSC mark.
Since you came second by not a lot, your assessment mark is moderated to something very close to her assessment mark, in order to preserve the distance between ranks. You keep your exam mark as your own, which in this case drags you down: 89 75 | 82 as final mark.
b) You do well (90 exam mark) and she does crap (75 exam mark)
She gets the top exam mark (yours, probably) as her assessment mark, and keeps her dodgy exam mark as her own, resulting in 90 75 | 83 as a final mark.
Your assessment mark again gets moderated fairly close to hers, and you keep your exam mark as your own, resulting in 89 90 | 90 as a final mark.
So yes, it's possible to beat this person - made easier by the fact that your assessment marks are always going to be close together - but only if you do better in the HSC exam than her. It all depends on your exam
Hope that helps.