Shulchan Arukh, Orach Chayim 153:20שולחן ערוך, אורח חיים קנ״ג:כ׳
There is one who says [regarding] a Torah scroll that is assumed to have belonged to Reuven's ancestors, that the community may not possess it.
יש מי שאומר שס"ת שהוחזק שהיה של אבותיו של ראובן אין הצבור יכולים להחזיק בו:
Mishnah Berurah 153:99משנה ברורה קנ״ג:צ״ט
...
(צט) אין הצבור יכולים - ולא אמרינן דבודאי החליטה להקדש ולא דמי לכלי הקודש של כסף שנהגו להביאם בביהכ"נ המובא בסעיף י"ח דאין הבעלים יכולים להוציאם לחולין דשאני הכא בס"ת שכן הדרך לעשות ס"ת ע"מ כן להניחה בביהכ"נ שיקראו בה רבים ושתהיה מונחת שם עד יום פקוד הבעלים אותה ליקח לביתו ואפילו היתה לבושה מעילין של צבור ולא הקפיד לא אמרינן בשביל זה מסתמא כבר סילק ידו ממנה משום דכן המנהג תדיר להחליף המעילין מס"ת אל ס"ת הן של יחידים הן של הקהל מיהו כמה אחרונים כתבו דגם הכא בס"ת מיירי שאנו יודעין בבירור שבתחלה לא הניחה לחלוטין רק שהשאילה לבהכ"נ שיקראו בה רבים ואשמועינן דלא אמרינן כיון שהניחה זמן רב מסתמא כבר החליטה להקדש אבל בהניחה סתם אמרינן דמסתמא אקדשה לעולם וכההיא דכלי הקודש בסעיף י"ח הנ"ל. ועיין במ"א סקכ"ב שכתב דמנהג העולם כהיום למכור ס"ת אפילו נתנו מתחלה לביהכ"נ לקרות בו וכתב דכיון שנהגו כן הו"ל כאלו התנו מתחלה בהדיא שלא תחול קדושת רבים עליהן ולפ"ז נראה דלכו"ע אין להחמיר בזה בדיעבד ומ"מ לכתחלה בודאי טוב להתנות בהדיא שאין נותנה לחלוטין:
Shulchan Arukh, Yoreh De'ah 259:2שולחן ערוך, יורה דעה רנ״ט:ב׳
Moneys donated for purposes of the synagogue or of the cemetery, may, if the community sees fit to do so, be diverted to the use of the House of Study or to the maintenance of a Religious School, even against the will of the donors; but moneys collected for the support of a school cannot be commuted to the synagogue.
RMI.—Only where there is ground for apprehension that there will not be sufficient money for school purposes [if this money were to be diverted to the synagogue]; but where the members of the community support the schools generously (so that if this money is spent for a synagogue they will surely furnish more money for the schools); in such a case, it is permitted, even in a place where it is [usually] forbidden to change the will of the donor. If one donates a sum of money for a purpose for which there is no need [at present]; as, for example, he donates a site for a House of Study and for certain reasons the building cannot be erected immediately, the donor cannot retract, but the site remains until the House of Study is eventually erected. All this applies in places where there is no established custom. But where it is established that the Gabbai or the assembled community has the right to commute the funds from one charitable purpose to another, we follow the usual custom; for we presume that the donor makes his donation subject to custom and that the authorities accept it with this condition at heart [that they may dispose of it at their discretion]. Of course, where the donor expressly stipulates that his donation shall not be subject to change, naturally it cannot be commuted.
RMI.—Only where there is ground for apprehension that there will not be sufficient money for school purposes [if this money were to be diverted to the synagogue]; but where the members of the community support the schools generously (so that if this money is spent for a synagogue they will surely furnish more money for the schools); in such a case, it is permitted, even in a place where it is [usually] forbidden to change the will of the donor. If one donates a sum of money for a purpose for which there is no need [at present]; as, for example, he donates a site for a House of Study and for certain reasons the building cannot be erected immediately, the donor cannot retract, but the site remains until the House of Study is eventually erected. All this applies in places where there is no established custom. But where it is established that the Gabbai or the assembled community has the right to commute the funds from one charitable purpose to another, we follow the usual custom; for we presume that the donor makes his donation subject to custom and that the authorities accept it with this condition at heart [that they may dispose of it at their discretion]. Of course, where the donor expressly stipulates that his donation shall not be subject to change, naturally it cannot be commuted.
צדקות שהתנדבו לצורך בית הכנסת או לצורך בית עלמין יכולין בני העיר לשנותם לצורך בית המדרש או ת"ת אפילו אם הבעלים מעכבים אבל לא מתלמוד תורה לצורך בית הכנסת: הגה ודוקא בדאיכא למיחש שלא יהיה להם ספוק לתלמוד תורה אבל במקום שבני העיר מספקים לתלמוד תורה ואם יוציאו אלו המעות לצורך ב"ה יתנו מעות אחרים לתלמוד תורה כשיצטרכו מותר (מהרי"ק שורש קכ"ח) ואפי' אם הוא במקום שאסור לשנות אם אינן צריכים לדבר שנדר כגון שהקדיש קרקע לבנות עליה בהמ"ד ואין יכולין לבנות מיד אין המתנדב יכול לחזור בו אלא יהיה עומד כך עד שיבנו עליה (מרדכי פ' בני העיר) וכל זה במקום שאין מנהג ידוע בעיר אבל במקום שנוהגים שהגבאי או בני העיר משנים לכל מה שירצו או אפי' במקום שנוהגים שאדם משים איזה דבר בבית הכנסת כגון ספר תורה או כלי כסף וכדומה וכשירצה חוזר ולוקחו וכשיורד מנכסיו מוכרו לאחרים הולכים אחר המנהג דכל המקדיש אדעתא דמנהג הוא מקדיש ולב ב"ד מתנה על זה ובלבד שיהיה מנהג קבוע (כן משמע מהב"י ממהרי"ק שורש קס"'א) ומ"מ אם התנה המקדיש בפירוש שלא ישנו הקדשו ולא יהא כח בזה פשיטא שאסור לשנותו וע"ל סי' רנ"ו סעיף ד':
Siftei Kohen on Shulchan Arukh, Yoreh De'ah 259:6:1שפתי כהן על שולחן ערוך יורה דעה רנ״ט:ו׳:א׳
...
וכל זה במקום שאין מנהג ידוע כו'. ואז אפילו טוען המקדיש טענת ברי שלא הקדישו לאוכל כמיניה לאפוקי מחזקת הקדש אלא א"כ התנה ברבים או בפני עדים בשעה שהקדיש כ"כ מהרש"ל בתשובות סי' ט"ו ומביאו הב"ח וכתבו שם כן גם בס"ת ולמדו כן מדברי מהרי"ק שורש קס"א גבי כלי כסף של הקדש ע"ש אבל בתשובת מהר"י כהן מקראקא סי' כ"א כתב שחלוקים הם כי ס"ת שדרך ומנהג העולם להניח בב"ה וידוע דשם האב נקרא על הס"ת א"כ מי יוציאה מחזקת האב כי מה שהניח הס"ת לשם אין ראיה שהיא של הק"ק כי בזמנים אלו עיקר כתיבת ס"ת להניח לקרות בס"ת ברבים וגם קדושתה גדול ואין ראוי בכל מקום להניח ס"ת ולכן אין ראיה כי אף שהניחו הוא לשם בב"ה אין ראיה שהקדישו אבל הכלי כסף אין המנהג להניחם בב"ה ובאם לא הקדישוהו לא היו מניחים אותם בב"ה רק היו משתמשים בב"ה בשעת הצורך ואחר כך היו לוקחים לביתו וכתב מהרי"ק בשורש קס"א שכלי כסף הנ"ל שהניחהו שם הם בחזקת הק"ק וגם בס"ת כתב בשורש ע' שהוא בחזקת הבעל ששמו נקרא עליו ר"ל על מי שאומרים זה ס"ת של פלוני מטעם הנ"ל והאריך שם בענין מי ראוי להעיד כי בני העיר נוגעין בעדות אם לא יסתלקו וגם שיהא שם גם כן ס"ת אחרת וכן כתב הטור סי' ל"ו שכולן נוגעים בעדות וסברותיו נכונים מתיישבים על הלב וגם במה שחלק בין כסף לס"ת סברא נכונה היא כי קשה להוציא דבר מחזקת בעליו אם לא בהוכחה מבוררת הארכתי בדין ס"ת כי שמעתי שרב אחד פסק גם בס"ת שהיא של הקדש לכן הוצרכתי להביא ראיה ולהאריך בראיות וטעמים דלא כוותיה ע"כ: