Fr John Hardon defines “merit” in his “Catholic Dictionary” (the work has the nihil obstat and imprimatur):
MERIT. Divine reward for the practice of virtue. It is Catholic doctrine that by his or her good works a person in the state of grace really acquires a claim to supernatural reward from God. “The reward given for good works is not won by reason of actions which precede grace, but grace, which is unmerited, precedes actions in order that they may be performed meritoriously” (II Council of Orange, Denzinger 388).
Certain conditions must be present to make supernatural merit possible. The meritorious work must be morally good, that is, in accordance with the moral law in its object, intent, and circumstances. It must be done freely, without any external coercion or internal necessity. It must be supernatural, that is, aroused and accompanied by actual grace, and proceeding from a supernatural motive. The person must be a wayfarer, here on earth, since no one can merit after death.
Strictly speaking only a person in the state of grace can merit, as defined by the Church (Denzinger 1576, 1582).
Merit depends on the free ordinance of God to reward with everlasting happiness the good works performed by his grace. On account of the infinite distance between Creator and creature, a human being alone cannot make God his or her debtor, if God does not do so by his own free ordinance. That God has made such an ordinance is clear from his frequent promises, e.g., the Beatitudes and the prediction of the Last Judgment.
The object of supernatural merit is an increase of sanctifying grace, eternal life (if the person dies in divine friendship), and an increase of heavenly glory. (Etym. Latin
merces, hire, pay, reward.)
The “Catholic Encyclopedia” discusses the “conditions of merit” at article 3 here:
https://www.newadvent.org/cathen/10202b.htm
From Fr Spirago in his “The Catechism Explained”:
Sinners are rewarded on this earth for the little good that they have done. The just on the other hand are for the most part punished in this life for the evil they have done. Our Lord says, “Woe to you that are rich; for you have your consolation,” i.e., your reward for the good you have done is given you in this world ( Luke vi. 24 ).