This is the wording of our teacher, the Rema: And specifically when the house of the partners is of Israelites. But a house of an Israelite and a star-worshipper—they are exempt from mezuzah. And so too courtyards or cities where some star-worshippers dwell—they are exempt from mezuzah. Thus far his words. And I wonder that he decided the halacha accordingly. For it is true that the Mordechai ruled so at the end of the chapter "Before their festivals," see there. But the Rashba in Chullin (Chullin 135b) wrote explicitly that it is obligated in mezuzah, and so ruled our teacher, the Beit Yosef, in his great book "Bedek HaBayit." And so ruled the Maharshal in "Yam Shel Shlomo" Chullin, chapter "Reshit HaGez" (siman 2). And they infer it from the fact that the Shas says there that a house of partnership is obligated in mezuzah, as it is written: "In order that your days shall increase"—a plural expression. And it asks: If so, why do I need "your house"? For the way of the right. See there. And why did it not say to exclude the partnership of a star-worshipper, as it says there previously regarding several things? And so the Tosafot questioned there. Rather, it is certainly obligated in mezuzah. And the "Yam Shel Shlomo" rejected all the words of the Mordechai there with good reason, see there. Therefore it seems to my humble opinion for the din: Since it is a doubt regarding a Torah commandment in a courtyard where Israelites and a star-worshipper dwell—the courtyard is obligated in mezuzah, unless the star-worshipper does not allow it and uproots it. But we have seen with our own eyes that they allow the fixing of a mezuzah and are not particular. (And behold the Levush and the Taz, subsection 2, wrote that partnership was included from "in order that your days shall increase," and in this case it is not applicable. And these are the words of the Mordechai, and they are astonishing words as the "Yam Shel Shlomo" wrote. And in truth, the Shach, subsection 6, also criticized this and wrote: Because the portion belongs to a star-worshipper, meaning: the Israelite does not have a complete house. And this too is from the Mordechai, and he learned this from nega'im as is explained in "Yam Shel Shlomo." And this too he rejected, see there. But the second reason that the Shach wrote due to danger, that he should not say the Israelite is performing sorcery against him—it is certainly a simple matter. For if the star-worshipper does not allow it, what shall the Israelite do? But in our days we have seen that they allow it. And behold, in a house this law is not applicable now, as it is not common for them to dwell in one room. But in a courtyard it is very common. And one must fix a mezuzah in a courtyard where an Israelite and a star-worshipper dwell. And so one should instruct the halacha in practice, unless the star-worshipper will not allow it.)
וזה לשון רבינו הרמ"א: ודווקא כשבית השותפים ישראל. אבל בית של ישראל ועובד כוכבים – פטורים ממזוזה. וכן חצרות או עיירות שמקצת עובד כוכבים דרים שם – פטורים ממזוזה. עד כאן לשונו. ותמיהני שהכריע כן להלכה. דהן אמת שכן פסק המרדכי סוף פרק "לפני אידיהן", עיין שם. אבל הרשב"א בחולין (חולין קלה ב) כתב מפורש דחייב במזוזה, וכן פסק רבינו הבית יוסף בספרו הגדול ב"בדק הבית". וכן פסק המהרש"ל ב"ים של שלמה" חולין פרק "ראשית הגז" (סימן ב'). ודייקי לה מדקאמר הש"ס שם דבית השותפות חייב במזוזה, דכתיב: "למען ירבו ימיכם" – לשון רבים. ופריך: ואלא ביתך למה לי לדרך ימין? עיין שם. ולמה לא קאמר למיעוטי שותפות עובד כוכבים, כמו שאומר שם מקודם על כמה דברים. וכן הקשו התוספות שם. אלא וודאי דחייב במזוזה. וכל דברי המרדכי שם דחה ה"ים של שלמה" בטוב טעם, עיין שם. ולכן נראה לעניות דעתי לדינא: כיון שהוא ספק תורה בחצר שדרים שם ישראלים ועובד כוכבים – חייב החצר במזוזה, אם לא שהעובד כוכבים אינם מניחים, ועוקרים אותה. אבל בעינינו ראינו שהם מניחים לקבוע מזוזה, ואינם מקפידים. (והנה הלבוש, והט"ז סעיף קטן ב, כתבו דשותפות איתרבו מ"למען ירבו", ובזה לא שייך. וזהו דברי המרדכי, ודברים תמוהים הם כמו שכתב ה"ים של שלמה". ובאמת גם הש"ך סעיף קטן ו השיג על זה וכתב: מפני שהמקצת הוא של עובד כוכבים, כלומר: ואין לו להישראל בית שלם. וגם זה מהמרדכי, ולמד זה מנגעים כמבואר ב"ים של שלמה". וגם זה דחה, עיין שם. אך הטעם השני שכתב הש"ך משום סכנה, שלא [י]אמר שהישראל עושה לו כשפים – וודאי דמילתא דפשיטא. דאם העובד כוכבים אינו מניח, מה יעשה הישראל? אבל בימינו ראינו שמניחים. והנה בבית לא שייך עתה דין זה, שאין רגילות שידורו בחדר אחד. אבל בחצר שכיח הרבה. וצריך לקבוע מזוזה בחצר שדרים בו ישראל ועובד כוכבים. וכן יש להורות הלכה למעשה, אם לא שהעובד כוכבים לא יניח.)