To Gain and to Give: Hilchot Tzedakah, Day 31

Tzedakah given on behalf of the deceased is a merit for them and is considered by Hashem as if the deceased themselves gave the tzedakah. Among Ashkenazim, it is the universal minhag to recite yizkor on various Yamim Tovim. The primary merit and purpose of yizkor is to give tzedakah on behalf of the departed.

רמ"א יו"ד ס' רמט סט"ז, שו"ע ורמ"א או"ח ס' תרכא, מ"ב סקי"ט