Our teacher, the Beit Yosef, wrote in section 10: There are those who say that an individual regarding his own—even a sefer Torah—it is permitted to sell it and to do with its proceeds whatever he desires, as long as he did not consecrate it for public reading. And there is one who forbids, unless it is to study Torah or to marry a woman. Thus far his words. The first opinion is the opinion of the Rosh and the Tur, and they hold that that which our sages, of blessed memory, said, "one may not sell a sefer Torah except to study Torah or to marry a woman," and likewise the entire sugya in Megillah—this is all regarding that of the community or an individual who turned it over to the community. But any individual regarding his own, when he makes even the greatest sanctity like a sefer Torah, from the beginning his intention is for this: that when he needs to, he may sell it and use the money. And likewise when he built a beit knesset or a beit midrash only for himself—he can always sell them or change them, because from the outset he made them with this intention. And it is not similar to what I wrote at the end of section 26, that in any event it is a vow—that is when they have not yet prayed in it at all, or have not studied in it at all. But here, behold, they have prayed and studied and he has fulfilled his vow—he may certainly do with it as he wishes as long as he did not turn it over to the public. And the "one who forbids" is the opinion of the Rambam in chapter ten of Sefer Torah, who wrote: One may not sell a sefer Torah...—and he did not distinguish between an individual and the public. And I wonder about this: for behold, even the Rosh and the Tur wrote thus in the laws of a sefer Torah in Yoreh Deah siman 270, see there. And despite all this, they distinguished here between an individual and the public, and what proof is there that the Rambam disagrees with this? And in my humble opinion, it would seem to say that regarding "sefer Torah," it deals with the one sefer Torah that is an obligation upon every man as explained there, and therefore even an individual is forbidden to sell it. This is not the case here, where it deals with another sefer Torah, where the prohibition is due to its sanctity—in this we distinguish between an individual who made it for himself and one who turned it over to the community, and there is no dispute here at all. And it requires further study. However, for the halachah, it appears that our teacher, the Beit Yosef, also held like the first opinion, and so wrote one of the great authorities. (Eliyah Rabbah subsection 22, and so wrote the Rema in Darkhei Moshe, that the custom is like those who permit, see there.)
כתב רבינו הבית יוסף בסעיף י: יש אומרים דיחיד בשלו – אפילו ספר תורה מותר למכרו ולעשות בדמיו כל מה שירצה, כל שלא הקדישו לקרות ברבים. ויש מי שאוסר אלא אם כן ללמוד תורה או לישא אשה. עד כאן לשונו. דעה ראשונה היא דעת הרא"ש והטור, וסבירא להו דזה שאמרו חכמינו ז"ל אין מוכרין ספר תורה אלא ללמוד תורה ולישא אשה, וכן כל סוגיא דמגילה – זהו הכל בשל ציבור או יחיד שמסר לציבור. אבל כל יחיד בשלו, כשעושה אפילו הקדושה היותר גדולה כמו ספר תורה מתחילה דעתו על זה, שכשיצטרך ימכרנה וישתמש בהמעות, וכן כשבנה בית הכנסת או בית המדרש רק לעצמו – יכול תמיד למוכרם או לשנותם, מפני דמעיקרא אדעתא דהכי עבדינהו. ולא דמי למה שכתבתי בסוף סעיף כ"ו דעל כל פנים נדר הוא – זהו כשלא התפללו בו עדיין כלל, או לא למדו בו כלל. אבל בכאן הא התפללו ולמדו וקיים נדרו – שפיר יכול לעשות בו כחפצו כל זמן שלא מסרו לרבים. וה"יש מי שאוסר" הוא דעת הרמב"ם ב[רמב"ם הלכות תפילין ומזוזה וספר תורה י|פרק עשירי מספר תורה, שכתב: אין מוכרין ספר תורה… – ולא חילק בין יחיד לרבים. ואני תמה על זה: והרי גם הרא"ש והטור כתבו כן בהלכות ספר תורה ביורה דעה סימן ע"ר, עיין שם. ועם כל זה חילקו כאן בין יחיד לרבים, ומה ראיה שרמב"ם חולק על זה? ולעניות דעתי היה נראה לומר דב"ספר תורה" מיירי בספר תורה האחת שחובה על כל איש כמבואר שם, ולכן גם יחיד אסור למוכרה. מה שאין כן כאן מיירי בספר תורה אחרת, דהאיסור הוא מצד קדושתה – בזה אנו מחלקים בין יחיד שעשה לעצמו לבין מסרה לציבור, ואין כאן מחלוקת כלל. וצריך עיון. מיהו לדינא נראה שגם רבינו הבית יוסף תפס כדעה ראשונה, וכן כתב אחד מהגדולים. (אליה רבה סעיף קטן כ"ב, וכן כתב הרמ"א בדרכי משה שהמנהג כהמתירין, עיין שם.)