The Shulchan Aruch · Yoreh De'ah
יורה דעה ר״עYoreh De'ah 270
Siman 270 of 402 in Yoreh De'ah — 2 se'ifim
הלכות ספר תורהA Torah Scroll· siman 270
Se’if 1א׳
מִצְוַת עֲשֵׂה עַל כָּל אִישׁ מִיִּשְׂרָאֵל לִכְתֹּב לוֹ סֵפֶר תּוֹרָה. וַאֲפִלּוּ הִנִּיחוּ לוֹ אֲבוֹתָיו סֵפֶר תּוֹרָה, מִצְוָה לִכְתֹּב מִשֶּׁלּוֹ. וְאֵינוֹ רַשַּׁאי לְמָכְרוֹ, אֲפִלּוּ יֵשׁ לוֹ הַרְבֵּה סִפְרֵי תּוֹרָה. וַאֲפִלּוּ אֵין לוֹ מַה יֹּאכַל רַק עַל יְדֵי הַדַּחַק (הַגָּהוֹת מַיְמוֹנִי פ"ו) וַאֲפִלּוּ לִמְכֹּר יָשָׁן כְּדֵי לִקְנוֹת חָדָשׁ, אָסוּר. אֲבָל לִלְמֹד תּוֹרָה אוֹ לִשָּׂא אִשָּׁה, מֻתָּר לִמְכֹּר אִם אֵין לוֹ דָּבָר אַחֵר לִמְכֹּר. הַגָּה: וְהוּא הַדִּין לְצֹרֶךְ פִּדְיוֹן שְׁבוּיִים, מֻתָּר לְמָכְרוֹ (גַּם זֶה שָׁם וְתוס' פ"ק דב"ב וַאֲגֻדָּה שָׁם). וְעַיֵּן בְּאֵלּוּ הַדִּינִים בא"ח סִימָן קנ"ג. שָׂכַר לוֹ סוֹפֵר לִכְתֹּב לוֹ סֵפֶר תּוֹרָה, אוֹ שֶׁקְּנָאוֹ וְהוּא הָיָה מֻטְעֶה וְהִגִּיהוֹ, הֲרֵי זֶה כְּאִלּוּ כְּתָבוֹ (בֵּית יוֹסֵף בְּשֵׁם נ"י). אֲבָל לְקָחוֹ כָּךְ וְלֹא הִגִּיהַּ בּוֹ דָּבָר, הָוֵי כְּחוֹטֵף מִצְוָה מִן הַשּׁוּק (טוּר בְּשֵׁם ריב"ל פֶּרֶק הַקוֹמֵץ). וְאֵינוֹ יוֹצֵא בָּזֶה.
There is a Positive Commandment on every Jewish man to copy a Torah Scroll for himself. Even if his ancestors bequeathed one to him, he is still commanded to copy one of his own. He is not permitted to sell it even if he owns many Torah Scrolls. This is even if he does not have what to eat. (A Torah Scroll can be sold] only under the most dire circumstance)(Haghoth Maimoni Chapter 6). Even selling an old [Torah Scroll] in order to buy a new [Torah Scroll] is forbidden. However [if the scroll is sold in order to acquire funds] to study Torah or to marry a woman the sale is permitted if the seller has nothing else to sell. Rema: For redeeming Jewish captives it is permitted to sell [a Torah Scroll] (See Tosfoth Bava Bathra chapter 1 beginning with "ואגודה שם", and Orah hayim 153). [If] he hired a scribe to copy a Torah Scroll for him or [If] he bought [a Torah Scroll] with copying errors and he proofread it, it is as if he copied [the Torah Scroll] himself (Beith Yosef quoting Nimukei Yosef). However [if] he bought it as is [with errors] and did not proofread it at all, it is like he abducted a Mitzva from the market and he does not fulfill his obligation [of copying a Torah Scroll] (Tur quoting Rabbi Yehoshua ben Levi from Menahoth chapter 2)
Se’if 2ב׳
הָאִדָּנָא, מִצְוָה לִכְתֹּב חֻמְשֵׁי תּוֹרָה וּמִשְׁנָה וּגְמָרָא וּפֵרוּשֵׁיהֶן, וְלֹא יִמְכְּרֵם אִם לֹא לִלְמֹד תּוֹרָה וְלִשָּׂא אִשָּׁה.
Nowadays the commandment is to copy the five books of Moses, the Mishna, and the Talmud with its commentaries. [These books] can only be sold [in order to gather funds] to study Torah or to marry a woman.
Shulchan Aruch, Yoreh De'ah — Torat Emet 357 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0