Rabbeinu Bahya, Devarim 21:8
רבינו בחיי, דברים כא ח
Rabbeinu Bahya, Devarim 21:8
The passage derives from a Pesikhta drasha that living people can expiate through their money and the dead through money given by the living, and applies this principle to teach that dedications made by the living on behalf of the dead benefit the dead; accordingly, when a son dedicates something or recites Kaddish or another blessing in the synagogue on behalf of his father, this constitutes a merit for the father, as illustrated in an aggadic account involving Rabbi Akiva found in Masekhet Kallah.
כפר לעמך. דרשו בפסיקתא אלו החיים שמתכפרין בממונם, אשר פדית אלו המתים שמתכפרין בממון החיים. ולמדנו מזה שההקדשות שנוהגין החיים להקדישם בעד המתים, שיש להם תועלת למתים, וכל שכן אם הבן מקדיש בעד אביו שהוא זכות לאביו בהיות אוכל הבן פירותיו, והוא הדין לאומר בשבילו קדיש או שום ברכה בבית הכנסת בצבור, וכמו שאמרו באגדה באותו מעשה של רבי עקיבא, וכדאיתא במסכת כלה.

