For the work of a man shall he render unto him, and cause every man to find according to his ways.
Read Chapter 34
Gregory The Dialogist
44. He well said, that iniquity or unmercifulness is not in Almighty God. But that which he added is by no means always the case in this life, namely, that He renders to each man according to his work, and according to his own ways. [see Rev. 22, 12. 2 Cor. 5, 10.] For both many who commit unlawful and wicked deeds He prevents of His free grace, and converts to works of holiness: and some who are devoted to good deeds He reproves by means of the scourge, and so afflicts those who please Him, as though they were displeasing to Him. As Solomon bears witness, saying, There are just men to whom many things happen, as though they had done the deeds of the wicked; and there are wicked, who are as secure as though they had the deeds of the just. [Eccles. 8, 14] God doubtless so ordains it of His inestimable mercy, that both scourges should torture the just, lest their doings should elate them, and that the unjust should pass this life at least without punishment, because by their evil doings ...
“Therefore, hear me, you who have sense, far be it from God that he should do wickedness. For according to their deeds he will repay them.” Since, according to the rules of debating, it is easier, in general, that they both lie rather than saying the truth. Here, as they speak against each other, it is nonetheless proven that the arguments of both are true. In fact, what Elihu says cannot be completely proved by holy Job to be false, and what Job asserts cannot be proven to be untrue. Therefore the fact that God repays according to the deeds of each one, though not in everybody, can be proven in many; on the other hand, Job is convinced by testimonies that God does not repay [many]. So, in a sense, it is evident that what both say is true: according to Elihu, [God] does not repay everybody; according to Job, he did not repay many. - "Exposition on the Book of Job 34.10–11"