ז הִתְנָה עִמָּהּ שֶׁלֹּא יִירָשֶׁנָּה, הֲרֵי זֶה לֹא יִירָשֶׁנָּה, אֲבָל אוֹכֵל פֵּרוֹת בְּחַיֶּיהָ. וְכֵן אִם הִתְנָה עִמָּהּ שֶׁיִירָשׁ מִקְצָת נְכָסִים, וְכֵן אִם הִתְנָה עִמָּהּ שֶׁאִם מֵתָה בְּלֹא בָּנִים יַחַזְרוּ הַנְּכָסִים לְבֵית אָבִיהָ, הַכֹּל קַיָּם. בַּמֶּה דְבָרִים אֲמוּרִים, שֶׁהִתְנָה עִמָּהּ קֹדֶם שֶׁתִּנָּשֵׂא, בְּעוֹדָהּ אֲרוּסָה, אוֹ בְּכוֹתֵב לָהּ בִּכְתֻבָּתָהּ בִּשְׁעַת כְּנִיסָה, אֲבָל אִם הִתְנָה עִמָּהּ אַחַר שֶׁנְּשָׂאָהּ, תְּנָאוֹ בָּטֵל, וְיִירָשֶׁנָּה. הַגָּה: וְעַיֵּן לְעֵיל סִימָן ס"ט. וְהָא דְּלָא מְהַנֵּי תְּנַאי לְאַחַר שֶׁנִּשֵּׂאת, דַּוְקָא שֶׁאָמַר שֶׁלֹּא יִירָשֶׁנָּה; מִכָּל מָקוֹם, אִם מְחַיֵּב עַצְמוֹ לְהַחֲזִיר לְיוֹרְשֶׁיהָ מַה שֶּׁיּוֹרֵשׁ מִמֶּנָּה, צָרִיךְ לְקַיֵּם (הָרַ"ן רֵישׁ הַכּוֹתֵב בְּשֵׁם הָרַמְבַּ"ן וְרִיבָ"שׁ סִימָן ס"ד וְק"ב):
7 If he makes a condition with her that he will not inherit her, behold he does not inherit her, but he can eat the usufruct during her lifetime. Similarly if he makes a condition that he will inherit part of her inheritance, or that if she dies without sons the property reverts to her father's house, all is valid. What are we talking about? That he made the condition with her before their marriage, while she was betrothed, or written into her ketubah at the time of the betrothal, but if he made the condition with her after the marriage, the condition is null, and he will inherit her. HGH: See above ch. 69. And it's only in the case of "I will not inherit her" written after marriage, that the agreement is null; in any case, if he obligates himself to pass the property he inherits from her on to her heirs, he must fulfill the obligation. (Ran beginning of Hakoteiv in the name of Ramban, and Rivash chs. 64 and 102).