Grace cannot be meritted, because, as Aquinas tells us, grace is the principle of merit and not vice versa (in other words, habitual grace produces and is the cause of merit).
Merit furthermore is given by God through Christ, who is the source, or treasurer of all merit. However, grace enables our free acts, including our prayer, to earn merit. And yes, we can even be insturmental in obtaining grace for others through intercessory prayer.
Merit on the other hand is “earned” for another relatively or conditionally speaking; since all merit comes through freely choosing what is right and just, a prayer for merit for someone else will mean, if such a prayer is answered, that God will move them to do something worthy of merit. But merit is not given without good works, and all good works are performed according to the measure of grace that each has.
The bottom line is, don’t stop praying for your friends, enemies and loved ones that they may be filled with grace and that such grace may move them to meritorious works! Prayer is truly powerful and efficacious, especially prayers for others.
God bless!