Our teacher, the Beit Yosef, wrote in section 6: One who enters his fellow's ruin and builds it without permission, we appraise for him and his hand is at a disadvantage. If the builder says, "I am taking my wood and my stones," we listen to him. If the owner of the land says to him, "Take what you built," we listen to him. Thus far his words. And in section 7 he wrote: Courtyards are fit for building and for adding houses and lofts within them; therefore, one who builds in his fellow's courtyard, he is like one who plants a field that is intended for planting, and we appraise for him how much a person would want to pay for this building to build it, provided that he builds a beneficial building appropriate for that courtyard according to the custom of that place. Thus far his words. And our teacher, the Rema, wrote that the builder cannot say, "I am taking my building." And regarding the ruin in section 6, he wrote that this is specifically if the ruin is not intended for building, but if it is intended for building, or in a place where a ruin is typically standing to be built, its law is like courtyards which will be explained nearby. Thus far his words. It is explicitly clear that he holds that that which the sages of blessed memory said, that the builder can say "I am taking my building" and the owner of the ruin or courtyard can say "take your wood and your stones," this is only when it is not intended to be built; but in one intended to be built, they do not have the power to say so. And I wonder, for the opinion of most poskim is not so. And how is the law of a building different from the law of a field intended for planting, where the owner of the field can say "uproot your trees and go," yet the owner of the trees cannot say so because he diminishes the land? But in a building, which does not diminish, he should be able to say so. And from his own words in section 1 this is proven, for he wrote simply that a vineyard is intended for planting, and he did not provide a gloss on the words of the author in section 2 who wrote that the owner of the field can say to him "uproot your trees," that this is specifically in one not intended for planting.
כתב רבינו הב"י בסעיף ו' היורד לתוך חורבתו של חבירו ובנאה שלא ברשות שמין לו וידו עה"ת ואם אמר בעל הבנין עצי ואבני אני נוטל שומעין לו א"ל בעל הקרקע טול מה שבנית שומעין לו עכ"ל ובסעיף ז' כתב החצרות הרי הם ראוים לבנין ולהוסיף בהם בתים ועליות לפיכך הבונה בחצר חבירו ה"ז כנוטע שדה העשויה ליטע ושמין לו כמה אדם רוצה ליתן בנין זה לבנותו והוא שיבנה בנין המועיל הראוי לאותו חצר כמנהג אותו מקום עכ"ל וכתב רבינו הרמ"א דלא יוכל הבונה לומר בניני אני נוטל ועל חורבה שבסעיף ו' כתב דדוקא אם החורבה אינה עשויה לבנות אבל אם עשויה לבנות או במקום שסתם חורבה עומדת לבנות דינו כמו חצרות שיתבאר בסמוך עכ"ל מבואר להדיא דס"ל דזה שאמרו חז"ל דהבונה יכול לומר בניני אני נוטל ובעל החורבה והחצר יכול לומר טול עציך ואבניך זהו רק כאינה עשויה להבנות אבל בעשויה להבנות אין ביכלתם לומר כן ותמיהני דדעת רוב הפוסקים אינו כן ומה נשתנה דין בנין מדין שדה העשויה ליטע דיכול בעל השדה לומר עקור אילנותיך וזיל ובעל האילנות אינו יכול לומר כן מפני שמכחיש הארץ אבל בבנין דאינו מכחיש יכול לומר כן ומדבריו עצמו בסעיף א' מוכח כן שכתב סתם כרם עשוי ליטע ולא הגיה בדברי המחבר בסעיף ב' שכתב שבעל השדה יכול לומר לו עקור אילנך שזהו דוקא באינה עשויה ליטע: