At school I once got a mark lower than another student for submitting work that was slightly better. This was for a piece of formative work on solving some basic equations, so “better” and “worse” seemed straight forward to quantify. When I asked the teacher why my grade was lower than I thought it ought to be and what had influenced his marking, he (jokingly) said that anything, including the colour of the wallpaper could influence the marks.
What could have been done about this? Now I mark work myself I realise that marking (by hand) is not precise. People can mark accurately within a tolerance, but it is unrealistic to expect that a teacher marking over 100 assignments will produce a highly precise mark for each one. Looking back, I would have felt less demotivated about these marks if I had had a clearer explanation of how the marks were generated and what level of precision can be expected from this sort of marking.