The 5% (which is probably better expressed as an actual mark value) difference between the student ranked first and the student ranked second that you have mentioned as an example is known as a relative difference (or relative gap). As you may already be aware, the highest Assessment Mark (which will be given to the student ranked first) is adjusted to equal the highest Examination Mark (i.e. the highest HSC exam mark achieved by any student in the school group). In the case of the Assessment Mark of the student ranked second, it will reflect the gap between the total school assessment mark (with "total school assessment mark" here meaning the total representing the actual marks received for school-based assessment tasks/exams) of the student ranked first and the student ranked second, which is evident as the moderation process maintains the rank order of students within the school group and the relative gaps between them.
Have a look at the following graph from NESA (containing a spelling mistake lol) which illustrates this:
In relation to your second question, the moderation process still prevails. This means that, with reference to the student ranked first, their Assessment Mark will be adjusted to equal the highest Examination Mark of any student in the school cohort. In the case of the student ranked second, their Assessment Mark will be determined by interpolation based on their rank as well as the applicable relative gaps, even if they achieve the highest Examination Mark.
I hope this helps!