عن أبي هريرة رضي الله عنه ، أن رسول الله صلى الله عليه وسلم قال: إذا رَأَيْتُم مَن يَبِيع أو يَبْتَاعُ في المسجد، فقولوا: لا أَرْبَحَ اللَّهُ تِجَارَتَكَ، وإذا رأيتم مَنْ يَنْشُدُ فيه ضَالَّة، فقولوا: لاَ رَدَّ الله عليك.
The Messenger of Allah (may Allah's peace and blessings be upon him) said: "When you see someone buying or selling in the mosque." Not naming the item that is being sold implies the coverage of this verdict to any purchasable item. The Messenger ordered his followers to supplicate against those who buy and sell in the mosque out loud. He ordered them to say: "May Allah not make your sale profitable."
This verdict has a connection to this verse: {So their commerce was profitless} [Sūrat al-Baqarah: 16]. It is also allowed to supplicate against both the buyer and the seller. The reason why purchasing inside the mosque is not allowed is because the mosque is the marketplace of the Hereafter.
The one who treats it as a marketplace of this world and not of the Hereafter makes himself liable to be supplicated against with loss and deprivation, which is the very opposite of his purpose, so that people would restrain from doing it. This action is undesirable inside the mosque out of veneration for it.
Download for free and never miss a prayer again