The goodness of works increases in man according to the fullness of truths from affection for which they are done; since the man who turns away from evils as sins wishes to know truths because truths teach uses and the quality of their good. This is why good loves truth and truth loves good, and they wish to be conjoined. So far, therefore, as such a man learns truths from an affection for them so far he does goods more wisely and more fully, more wisely because he knows how to distinguish uses and to do them with judgment and justice, and more fully because all truths are present in the performance of uses, and form the spiritual sphere that the affection for them produces. (A.E., n. 975.)
Take judges for an example: All who make justice venal [purchasable] by loving the office of judging for the sake of gain from judgments, and not for the sake of uses to their country, are thieves, and their judgments are thefts. It is the same if judgments are given according to friendship or favor, for friendships and favors are also profits and gains. When these are the end and judgments are the means, all things that are done are evil, and are what are meant in the Word by “evil works” and “not doing judgment and justice, perverting the right of the poor, of the needy, of the fatherless, of the widow, and of the innocent.” And when such do justice, and yet regard profit as the end while they do a good work, to them it is not good; for justice, which is Divine, is to them a means, and such gain is the end; and that which is made the end is everything, while that which is made the means is nothing except so far as it is serviceable to the end. Consequently, after death such judges continued to love what is unjust as well as what is just, and are condemned to hell as thieves. I say this from what I have seen. These are such as do not abstain from evils because they are sins, but only because they fear punishments of the civil law and the loss of reputation, honor, and office, and thus of gain.
It is otherwise with judges who abstain from evils as sins and shun them because they are contrary to the Divine laws, and thus contrary to God. Such make justice their end, and they venerate, cherish, and love it as Divine. In justice they see God, as it were, because everything just, like everything good and true, is from God. They always join justice with equity and equity with justice, knowing that justice must be of equity in order to be justice, and that equity must be of justice in order to be equity, the same as truth is of good and good is of truth.
As such make justice their end, their giving judgments is doing good works; yet these works, which are judgments, are to them more or less good as there is in their judgments more or less of regard for friendship, favor, or gain; also as there is more or less in them of a love of what is just for the sake of the public good, which is that justice may prevail among their fellow citizens, and that those who live according to the laws may have security. Such judges have eternal life in a degree that accords with their works; for they are judged as they themselves have judged. (A.E., n. 976.)