Jami` at-Tirmidhi, Volume 3, Book 12, Hadith 1321 (DarusSalam) ⓘ
Narrated Abu Hurairah: That the Messenger of Allah said: "When you see someone selling or buying in the Masjid then say: 'May Allah not profit your business.' And when you see someone announcing about something lost then say: 'May Allah not return it to you.'" The Hadith of Abu Hurairah is Hasan Gharib. This is acted upon according to some of the people of knowledge. They dislike selling and buying in the Masjid. This is the view of Ahmad and Ishaq. Some of the people of knowledge permitted selling and buying in the Masjid.
حَدَّثَنَا الْحَسَنُ بْنُ عَلِيٍّ الْخَلاَّلُ، حَدَّثَنَا عَارِمٌ، حَدَّثَنَا عَبْدُ الْعَزِيزِ بْنُ مُحَمَّدٍ، أَخْبَرَنَا يَزِيدُ بْنُ خُصَيْفَةَ، عَنْ مُحَمَّدِ بْنِ عَبْدِ الرَّحْمَنِ بْنِ ثَوْبَانَ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ " إِذَا رَأَيْتُمْ مَنْ يَبِيعُ أَوْ يَبْتَاعُ فِي الْمَسْجِدِ فَقُولُوا لاَ أَرْبَحَ اللَّهُ تِجَارَتَكَ وَإِذَا رَأَيْتُمْ مَنْ يَنْشُدُ فِيهِ ضَالَّةً فَقُولُوا لاَ رَدَّ اللَّهُ عَلَيْكَ " . قَالَ أَبُو عِيسَى حَدِيثُ أَبِي هُرَيْرَةَ حَدِيثٌ حَسَنٌ غَرِيبٌ . وَالْعَمَلُ عَلَى هَذَا عِنْدَ بَعْضِ أَهْلِ الْعِلْمِ كَرِهُوا الْبَيْعَ وَالشِّرَاءَ فِي الْمَسْجِدِ . وَهُوَ قَوْلُ أَحْمَدَ وَإِسْحَاقَ . وَقَدْ رَخَّصَ بَعْضُ أَهْلِ الْعِلْمِ فِي الْبَيْعِ وَالشِّرَاءِ فِي الْمَسْجِدِ .
also referenced under: Hadith 1321 (Reference) & Book 14, Hadith 125 (In-Book)