The Ruling on Buying and Selling in the Mosque According to Hadith
Excerpt taken from the book Aḥkām al-Masājid by Shaykh Muhammad Munir Qamar
Prohibition of Buying and Selling in Mosques
In the context of the prohibition of announcing lost items in mosques, several narrations also mention that buying and selling in the mosque is not permissible. The Prophet ﷺ even made supplication against those who engage in trade in the mosque.
Ibn ‘Amr (رضي الله عنه) reported:
نهى عن الشراء والبيع فى المسجد وأن ينشد فيه ضالة وأن ينشد فيه شعر ونهى عن التحلق قبل الصلاة يوم الجمعة
“The Prophet ﷺ forbade buying and selling in the mosque, announcing lost items in the mosque, reciting (vain) poetry in the mosque, and forming circles (for discussion) before the prayer on Friday.”

Supplication Against Traders in the Mosque
Abū Hurayrah (رضي الله عنه) reported that the Messenger of Allah ﷺ said:
إذا رأيتم من يبيع أو يبتاع فى المسجد فقولوا لا أربح الله تجارتك وإذا رأيتم من ينشد ضالة فقولوا لا ردها الله عليك
“If you see someone buying or selling in the mosque, say to him: May Allah not make your trade profitable. And if you see someone announcing a lost item in the mosque, say to him: May Allah not return it to you.”

Scholarly Clarification
Based on these and similar aḥādīth, buying and selling in the mosque is prohibited.
Ḥāfiẓ Ibn Ḥajar, quoting Māzarī in Fatḥ al-Bārī (1/550), stated:
There is difference of opinion regarding the permissibility of buying and selling in the mosque, but if the transaction occurs, then the validity of the contract is agreed upon unanimously.
Clearly, trade is a worldly affair and has no connection with the objectives of mosques. Thus, one should refrain from conducting any business inside the mosque.
