The Messenger of Allah ﷺ said, "If you see someone buying or selling in the mosque, say to him, 'May Allah grant no profit to your trade.' And if you see someone announcing a lost item in it, say to him, 'May Allah not return it to you.'"
حدثنا الحسن بن علي الخلال حدثنا عارم حدثنا عبد العزيز بن محمد أخبرنا يزيد بن خصيفة عن محمد بن عبد الرحمن بن ثوبان
أن رسول الله ﷺ قال إذا رأيتم من يبيع أو يبتاع في المسجد فقولوا لا أربح الله تجارتك وإذا رأيتم من ينشد فيه ضالة فقولوا لا رد الله عليك
No references are available.
Its isnad is sahih. Nasai narrated it in Amal al-Yawm wal-Layla, no. 176, from the hadith of Abdul-Aziz Darawardi, with the same wording. Ibn Khuzayma graded it sahih, no. 1305, as did Ibn Hibban, no. 313, and Hakim, on the condition of Muslim, 2/56, and Dhahabi agreed with him. Muslim also narrated it, no. 568, from the hadith of Abu Hurairah.