Then, when he says, now to him who works, he explains the aforementioned biblical citation as regards the words it was reputed to him as justice.
Two explanations of these words are given in the Gloss. In the first explanation they are linked to the final reward, concerning which
first, he shows how it is related to works;
second, how it is related to faith, at but to him who works not.
First, therefore, he says that to him who works the works of justice, the reward of eternal recompense—concerning which it is said, behold his reward is with him (Isa 40:10)—is not reckoned as a gift only, ...but according to debt: did you not agree with me for a denarius? (Matt 20:13).
But on the contrary it is stated below: the grace of God is life everlasting (Rom 6:23), and again: the sufferings of this time are not worthy to be compared with the glory to come (Rom 8:18). Therefore, that reward is not made as due, but as a gift.
The answer is that human works can be considered in two ways. In one way, according to the substance of the works, and considered this way they do not have anything deserving that the reward of eternal glory should be given.
In another way, they can be considered according to their source, namely, insofar as they are performed under God's impulse in accord with the intention of God who predestines. And in this respect the aforesaid reward is due them by debt, because, as is stated below: for whosoever are led by the Spirit of God, they are the sons of God . . . and if sons, heirs also (Rom 8:14, 17).
Source: Commentary on Romans