Here we have specifics on "corrective justice." If you recall, this involves voluntary and involuntary transactions/interactions.
This type of justice also has to do with equality. But the proportion involved here is "arithmetic" (rather than the geometric one Aristotle proposes in Chapter 3).
This equation deals with lawfulness and harm done. It doesn't matter who's been hurt (or who does the hurting). If a wrong has been done, the law must address it.
It's the judge's job to make things right hereāto restore the balance of justice. He does this by punishing (i.e. inflicting loss on) a person who's gained in some way from unlawful action.
Aristotle wants to make sure we understand the terms "gain" and "loss" so that we can arrive at equality (which is the middle term here).
"Gain" = more of the good; "loss" = less of the good (or more of the bad).
To re-establish equilibrium, corrective justice seeks that middle place, which may mean inflicting loss on someone who has unrightfully gained something.
Aristotle says that people go to a judge to resolve their disputes because a judge should be "the just ensouled."
Their job is to find that place of equality to make things right.
Aristotle uses geometry again to illustrate how a judge restores equality in each of his cases.
If we think of a line that has been cut into unequal parts, imagine the judge as one who takes the excess from the larger line and adds it to the smaller line.
Aristotle provides a more precise arithmetical proportion to calculate by how much a larger line should be reduced to achieve equality.
Loss and gain belongs to voluntary transactions (i.e. business transactions, one that at least two parties can enter into voluntarily).
When we take only exactly what we've contributed, then we can say that we have neither lost nor gained.
Aristotle calls this just distribution: coming out with neither more nor less, but with your skin intact.