1) AGADAH: DAMA BEN NESINAH
The Gemara records the story of a Nochri named Dama ben Nesinah of Ashkelon as an example of the extent to which one is obligated to honor his parents. Dama's father was in possession of a precious stone, the Yashfeh, for which the treasurers of the Beis ha'Mikdash offered him a huge sum of money. (The stone was needed to complete the Efod, the breastplate, of the Kohen Gadol.) The key to the box in which the jewel was kept was under the pillow of Dama's sleeping father. Dama refused to disturb his father's sleep and he declined the treasurers' offer. The following year, Dama's cow gave birth to a red heifer which the treasurers of the Beis ha'Mikdash offered to buy from him. He told them, "I know that you are willing to pay all the money in the world for this heifer. However, I ask you only for the money which I declined in last year's gem transaction."
The Gemara in Berachos (7b) teaches that a person's name reflects his destiny. The word the Gemara commonly uses for "money" is "Damim." Sleep is expressed by the word "Damich" in the Yerushalmi's version of the story. The word for "red," as in "red heifer," is "Adumah." All three of these words share the root letters of the word "Dama."
Moreover, the Chachamim teach that "there is nothing that is not hinted to somewhere in the Torah" (see Ta'anis 9a, Zohar 3:221). The stone which Dama sold to the Chachamim was the Yashfeh (as the Yerushalmi mentions). Rabeinu Bachye (Shemos 28:15) writes that this stone has the power to control excess bleeding ("Dam"). This quality of the Yashfeh stone is another parallel between Dama's name and the stone he sold.
An allusion to the story of Dama ben Nesinah may be found in the Torah. The Torah (Bereishis 25:29-34) relates that Esav returned home from the field to find Yakov preparing lentil soup. (Rashi explains that he was preparing the lentil soup, a food traditionally eaten by mourners, for his father, Yitzchak, who was mourning for the death of his father, Avraham). Esav, exhausted and ravenous, demanded that Yakov give him some of "that red stuff" ("Adom"). Esav's reference to the soup as "Adom" was one of the things which earned him the epithet, "Edom" ("red"). Yakov offered Esav the soup in return for Esav's birthright. Esav said he had no need for the birthright and sold it to Yakov. The verse relates that Yakov then gave ("Nasan") to Esav bread and lentils, and Esav disgraced his birthright.
Esav was called Edom ("red") because his desire for the red lentils was so strong that he relinquished his birthright in exchange for the soup. Perhaps this is the Torah's allusion to Dama ben Nesinah. "Adom" (Alef-Dalet-Mem) is spelled with the same letters as the word "Dama" (Dalet-Mem-Alef). The red lentils ("Adom") which were given over ("Nesinah") is an allusion to "Dama ben Nesinah." (Alternatively, Esav ("Edom") who gave away ("Nesinah") his birthright for a dish of lentils alludes to "Dama ben Nesinah.")
What logical relationship is there between the story of Esav and the story of Dama ben Nesinah?
The Chachamim (Yerushalmi) state that Esav excelled in his performance of the Mitzvah of honoring his parents. Raban Shimon ben Gamliel declared that in all of his years of serving his father, he did not do for his father even a fraction of what Esav did for his father. Naturally, Dama -- who was a general in the Roman army and thus a descendant of Esav (see Rashi to Bereishis 27:39, 36:43) -- also excelled in the Mitzvah of honoring his father.
Why does the Torah allude to Dama's noble conduct in this particular incident in Esav's life? The Torah itself relates that Esav acted reprehensively by displaying such a cavalier attitude toward the birthright (Bereishis 25:34), the rights of which included the privilege to participate in the Avodah in the Beis ha'Mikdash. The answer is that Esav's conduct also resulted in a positive outcome: Yakov, who obviously was more fit to serve in the Beis ha'Mikdash, received the right to perform the Avodah in the Beis ha'Mikdash. In the merit of this positive outcome of his act, Esav was blessed with the righteous Dama among his offspring. Although Dama lived generations later, Esav -- through his descendant Dama -- was given the opportunity to rectify his sin of spurning the Avodah of Hash-m in the Beis ha'Mikdash. One attains atonement for his sin, and the sin is considered rectified, when the penitent sinner later faces and overcomes the same temptations which he faced when he first sinned (Rambam, Hilchos Teshuvah 2:1). Perhaps such repentance is effective even in a multigenerational context. The descendant of a sinner can attain atonement for the sin of his forebear to a certain degree by not succumbing to the temptations which his forebear faced.
When the representatives of the Beis ha'Mikdash sought to purchase the components necessary to perform the Avodah, it was Dama ben Nesinah who provided what was missing. Esav, the "grandfather," had shown his contempt for the Avodah when he exchanged the birthright for a bowl of soup. Dama rectified that sin when he showed respect for the needs of the Beis ha'Mikdash. He facilitated the Avodah in the Beis ha'Mikdash by supplying the gem which the Chachamim needed for the Efod. While Esav was willing to "sell" the rights to perform the Avodah in order to satisfy his thirst for physical pleasure, Dama declined the huge financial gain which he was offered for the stone. Just as Esav received something red (lentils) in return for his sale, Dama was granted the red heifer as a reward for his sale.

31b----------------------------------------31b

2) AGADAH: "HAREINI KAPARAS MISHKAVO" -- "I AM AN ATONEMENT FOR HIS SOUL"
QUESTION: The Gemara teaches that one is obligated to honor his parent even after the parent's death. One way in which a person honors his father posthumously is by saying the words, "Hareini Kaparas Mishkavo," every time he quotes his father (within the first twelve months of his death). RASHI explains that this phrase means, "May Hash-m inflict punishment upon me to atone for the sins of my father who passed away."
How can one person's afflictions serve as atonement for the sins of another person? The person who sinned should be punished for his own sins.
(RAV EFRAIM ZALMAN STERNBUCH shlit'a discusses this topic at length in SEFER YISSACHAR U'ZEVULUN, chapter 3. The sources cited here are culled from his discussion.)
ANSWERS:
(a) THE MAHARSHAM (3:151) explains that the principle, "Kol Yisrael Arevin Zeh la'Zeh" -- "all of the Jewish people are responsible for one another," means that every Jew is in some way responsible for the sins of every other Jew. This principle enables one Jew to make himself a guarantor ("Arev") for another. When one person serves as guarantor for the repayment of a loan, the lender has the option to collect from either the debtor himself or from the guarantor. Similarly, one who says "Hareini Kaparaso" makes himself a guarantor for the sins of his father and gives Hash-m the option to collect either from him or from the actual sinner.
However, the MACHANEH CHAIM (Choshen Mishpat #20) points out that it is evident from numerous verses that one must bear personal liability for his own sins (see, for example, Yechezkel 18:20 and Tehilim 49:8). Rav Efraim Zalman Sternbuch also cites RAV HAI GA'ON (quoted by MAHARAM ALSHAKER #101), who writes that one certainly is unable to trade or sell the reward for a Mitzvah or the punishment for an Aveirah which he did.
(b) The MACHANEH CHAIM suggests instead that the declaration of "Hareini Kaparas Mishkavo" is merely a way to give honor to the deceased or to pray for his soul. It is as though one says, "I wish that my afflictions could be an atonement for him" (but not that they actually can be).
Rav Efraim Zalman questions these two explanations from the Gemara here which teaches that during the first twelve months after the death of one's father, the son is required to say "Hareini Kaparas Mishkavo" every time he mentions his father. However, the Halachah is that a person is not required to undergo physical torture or hardship in order to honor his parents. For example, he is not required to beg from door to door in order to raise money to honor them (see Shulchan Aruch YD 240:5). Similarly, one is not required to suffer by giving up a prospective spouse because his father disapproves (see VILNA GA'ON to YD 240:5). Accordingly, one should not be required to undergo afflictions to attain atonement for his father. Why, then, does the Gemara obligate him to say that he wants to suffer afflictions in order to atone for his father if he is not obligated to suffer afflictions for his father's benefit? Even if he does not really receive the afflictions, as the Machaneh Chaim suggests, he should not be required to say that he "wishes" he could if the Halachah does not obligate him to honor his father in such a manner.
Rav Efraim Zalman rejects the proposition of Rav Binyamin Stern in B'TZEL HA'CHOCHMAH (6:17-22) who writes that one's obligation to honor his parent is greater after his parent's death than when his parent is alive. Moreover, it seems clear from a number of sources that the afflictions which a son experiences indeed atone for the sins of his father (see, for example, BEIS YOSEF OC 284). Rashi's words also imply that a person's own afflictions are able to atone for the deceased.
(c) Rav Efraim Zalman Sternbuch and his father, RAV MOSHE STERNBUCH shlit'a (Teshuvos v'Hanhagos 2:47), write that according to the TOSFOS RI HA'ZAKEN here in Kidushin, one says "Hareini Kaparas Mishkavo" only when he quotes a teaching of his father. Accordingly, this declaration is not necessarily an expression of one's acceptance of afflictions to atone for the sins of his father. Rather, with this declaration one expresses, "If I made a mistake when I repeated my father's statement, then let me be punished for misquoting him, instead of him for not teaching me properly, because it is my mistake and not his."
The Rishonim, however, do not seem to agree with this ruling. The DARCHEI MOSHE (YD 240) cites RABEINU YERUCHAM who writes explicitly that whenever one mentions his father (or Rebbi) during the first year after his death, he should say "Hareini Kaparas Mishkavo," even when he does not quote a teaching in his name.
(d) Rav Efraim Zalman Sternbuch (in Sefer Yissachar u'Zevulun, p. 55) writes that perhaps one may attain atonement for his father only for the sin of not raising his son properly. The son says, "If I sin, and as a result my father becomes deserving of punishment because of his failure to educate me properly, I should be punished and not my father." He bases this approach on the words of the Rishon, RABEINU SHNEUR, quoted by the BEIS YOSEF (OC 284).
The logic behind this is that one is able to atone for someone else's sin which caused his own sins by forgiving the other person and suffering for his own sins. Alternatively, when he says that he accepts upon himself afflictions for his sins (which were committed as a result of a deficiency in his education), he does Teshuvah for his misdeeds and thereby corrects his wrongdoing, which consequently corrects his father's failure to educate him (since the son eventually became educated properly as his Teshuvah demonstrates). As a result, his father also benefits.
According to this, it is clear why the son is obligated to accept such afflictions for his father: it is his actions which cause his father to be punished.
(e) Rav Efraim Zalman writes that he later found a responsum of the MAHARAM CHALAVAH (#17) who discusses at length the principle that the punishment for one's sin cannot be redirected to another person. However, he shows that the declaration of "Hareini Kaparas Mishkavo" indeed provides atonement for the deceased, and not merely by serving to forgive the father for the sin of not providing a proper education for his son. He refers to the Gemara in Sanhedrin (104a) which implies that a son may exonerate his father from punishment ("Bera Mezakeh Aba"). Similarly, the Gemara in Chagigah (15b) implies that Rebbi Meir and Rebbi Yochanan were able to procure atonement for Acher (Elisha ben Avuyah).
The Maharam Chalavah explains how the atonement works. "It is appropriate for him to atone for his father," he writes, and since the son "is the produce, the fruit, of a Tzadik," he is able to effect atonement for that Tzadik. Similarly, a Talmid is able to effect atonement for his Rebbi since he learned Torah from him, and it is appropriate for the Talmid to save his Rebbi just as a son saves his father. (A similar answer is given by the TESHUVOS HA'RASHBA 5:49.)
His intention might be as the Gemara in Yoma (87a) says, "One who causes merit for others, no sin will come upon his hands." The Gemara explains that Hash-m saves such a person from sin because it is not proper for the Rebbi to suffer punishment in Gehinom while his Talmidim bask in the reward of Gan Eden. Similarly, when one teaches Torah to his son or disciple who then fulfills the Mitzvos as a result, it is not appropriate that the father or Rebbi should suffer for his sins while the son or disciple is rewarded for his merits, which are to the credit of the one who taught him. Consequently, the son or disciple has a moral obligation to save his father or Rebbi who caused him to merit reward. This moral obligation is what obligates him to accept even physical suffering to atone for his father, and it is what enables his acceptance of suffering to effect atonement for his father. (See also Insights to Sukah 20:2.)