A STIPULATION NOT TO INHERIT ONE'S WIFE [Tana'im:inheritance:wife]
Gemara
83a (Mishnah): If a man wrote to his wife 'I have no claim or dealings in your property, nor in its Peros, nor in the Peros of its Peros, in your lifetime and after your death', he does not eat the Peros in her lifetime, and does not inherit her if she dies;
R. Shimon ben Gamliel says, if she dies he inherits her, because he stipulated contrary to Torah. Any Tnai contrary to Torah is void.
Question (Beraisa): If a man wrote to his friend 'I have no claim or dealings in this field', these words are void.
Answer (d'Vei R. Yanai): The case is, he wrote to his wife during Eirusin. (He did not yet acquire her property.)
This is like the laws of Rav Kahana and Rava:
(Rav Kahana): One may stipulate not to inherit an inheritance that comes from elsewhere.
(Rava): If one says 'I do not want Chachamim's enactment' in a case like this (the enactment was for his benefit), we heed him.
83b (Rav): The Halachah follows R. Shimon ben Gamliel, but not for his reason.
R. Shimon holds that a husband inherits his wife mid'Oraisa, and a Tnai contrary to Torah is void. Rav holds that a husband inherits his wife mid'Rabanan, and Chachamim strengthened their enactments as much as Torah law.
Rishonim
Rif and Rosh (42a and 9:1): Rav rules like R. Shimon ben Gamliel, who says that a Tnai not to inherit one's wife is Batel because it is contrary to Torah. The Halachah does not follow him, for we hold that a monetary Tnai is valid.
Mordechai (294): The Yerushalmi says that a monetary Tnai is valid. (Perhaps this is why) the Rif rules unlike Rav. R. Tam says that we rely on the Yerushalmi; it does not argue with the Bavli. A monetary Tnai contrary to Torah is valid, but not a Tnai to uproot an enactment mid'Rabanan, for Chachamim strengthened their enactments more than Torah law. Rav says that the Halachah follows R. Shimon ben Gamliel, but not for his reason.
Beis Shmuel (EH 38:13): The Mordechai derives this from Rav, who rules like R. Shimon ben Gamliel, that a Tnai not to inherit one's wife is void. However, all Poskim disagree. They say that a Tnai after Nisu'in does not help, just like a son cannot stipulate not to inherit his father. I do not know why the Rema rules like the Mordechai against the Poskim.
Ba'al ha'Ma'or: The Rif commanded to emend the text of his Halachos to say that the Halachah does not follow Rav, based on the Yerushalmi. I see no reason to rule unlike the Bavli due to the Yerushalmi. Normally, a monetary Tnai is valid. Here is different, because inheritance is automatic, therefore one cannot uproot it.
Rebuttal (Milchamos Hash-m): We do not find that it matters whether or not the matter is automatic. There are three opinions. R. Shimon ben Gamliel holds that a Tnai contrary to Torah is invalid. Rav holds that a Tnai contrary to Torah is invalid, and also a Tnai contrary to a mid'Rabanan law, for Chachamim strengthened their enactments like Torah law. The Bavli rejects both of these. R. Yehudah says that a monetary Tnai is valid, even regarding inheritance (Bava Basra 126b). The Rif rules unlike R. Shimon ben Gamliel, but not due to the Yerushalmi. Rather, it is because Rav Kahana taught that one can stipulate not to inherit an inheritance that does not come through his ancestors (i.e. his wife).
Ra'avad: There are different texts of the Rif; it is not clear which is the latter version. Presumably, he retracted to hold like R. Shimon ben Gamliel. Firstly, it was not clear that he would outlive and inherit her, so the Tnai is merely (insincere) words. Also, it is Davar she'Lo Ba l'Olam. All the Tana'im in the world do not help. It is not considered a monetary Tanai. Even though the Yerushalmi says that a father can give to his daughter and stipulate (if you die childless, the property will return to my family), there is different, for he has the property now.
Ran (DH b'Kosev): One may stipulate not to inherit an inheritance that comes from elsewhere, i.e. at the time he stipulates he is not the heir, e.g. a husband during Eirusin. This excludes inheritance of a father. Since he is the heir, he can uproot this only through a sale or gift, and he cannot do so for he did not totally inherit the property. A husband after Nisu'in is to his wife (an heir) like a son to his father. Before Eirusin he has no connection to inheriting her, so a Tnai is meaningless.
Ran (42a DH ul'Inyan): A Tnai after Nisu'in does not help, unless he stipulates to return what he inherits to her heirs. That certainly helps.
Rambam (Hilchos Ishus 12:6): If a husband stipulated to be exempt from one of the obligations of a husband, or his wife stipulated that he will not merit one of the privileges of a husband, it is valid. There are three exceptions in which it is invalid: her Onah, her Ikar Kesuvah, and inheriting her.
Rambam (9): If after Nisu'in he stipulated that he will not inherit her, it is Batel, even though inheritance of a husband is mid'Rabanan. Chachamim strengthened their enactments like Torah law.
Rosh (ibid.): R. Chananel, the Ri and BaHaG rule like R. Shimon ben Gamliel. They bring a proof from the Yerushalmi. We rule like him for a different reason, because he tried to remove himself from his wife's property before he had any ownership in the property itself. (He had rights only to eat the Peros.) This is like a son who stipulated that he will not inherit his father. The Ramban rejects the proof. A Tnai after Nisu'in not to inherit her is like a son stipulating not to inherit. Our Gemara establishes the Mishnah to discuss a Tnai during Eirusin, but all agree that a Tnai after Nisu'in does not help. Since there is no clear proof, we should say that every monetary Tnai is valid.
Poskim
Shulchan Aruch (EH 69:6): If a husband stipulated to be exempt from one of the obligations of a husband, or his wife stipulated that he will not merit one of the privileges of a husband, it is valid. There are three exceptions in which it is invalid: her Onah, her Ikar Kesuvah, and inheriting her.
Shulchan Aruch (7): A Tnai not to inherit her is invalid after Nisu'in or before Kidushin. If he stipulated during Eirusin, it helps.
Chelkas Mechokek (12): Even Kinyan (Chalipin) does not help after Nisu'in, for a person cannot remove himself from what he is destined to inherit.