Translation
(55) Wills and Testaments (Wasaayaa)
كتاب الوصايا
(30) Chapter: The foundation of an endowment for building a mosque
(30) باب وَقْفِ الأَرْضِ لِلْمَسْجِدِ
Sahih al-Bukhari 2774 

Narrated Anas bin Malik:

When Allah's Messenger (ﷺ) came to Medina, he ordered that a mosque be built. He said, "O Bani An- Najjar! Suggest me a price for the garden of yours." They replied, "By Allah, we will not ask its price except from Allah."

حَدَّثَنَا إِسْحَاقُ، حَدَّثَنَا عَبْدُ الصَّمَدِ، قَالَ سَمِعْتُ أَبِي، حَدَّثَنَا أَبُو التَّيَّاحِ، قَالَ حَدَّثَنِي أَنَسُ بْنُ مَالِكٍ ـ رضى الله عنه ـ لَمَّا قَدِمَ رَسُولُ اللَّهِ صلى الله عليه وسلم الْمَدِينَةَ أَمَرَ بِالْمَسْجِدِ وَقَالَ ‏ "‏ يَا بَنِي النَّجَّارِ ثَامِنُونِي بِحَائِطِكُمْ هَذَا ‏"‏‏.‏ قَالُوا لاَ وَاللَّهِ لاَ نَطْلُبُ ثَمَنَهُ إِلاَّ إِلَى اللَّهِ‏.‏
Reference : Sahih al-Bukhari 2774
In-book reference : Book 55, Hadith 37
USC-MSA web (English) reference : Vol. 4, Book 51, Hadith 35
  (deprecated numbering scheme)