I think how far you are removed from the
direct financial impact of your job plays a major role in it.
It is harder to measure a cost on society inflicted by poorly educated students than it is to measure the cost of buggy, failing commercial software. Also, students who were academic failures are not necessarily guaranteed to fail in life, since there are ways to succeed in life other than by being good at school subjects, whereas an incorrect software program can never succeed.
The same holds true even inside the same field. It depends whether you are near a cash cow or a cost center. Working on infrastructure, building tooling for other developers is not likely to be rewarded as well as writing code that could cost your company millions if there is a bug.
There are also differences in specialization. An average game dev is probably going to make less than an average mobile dev, who in turn is going to make less than what a random quant makes.