"The location where the Prophet's Mosque was built belonged to Banu Najjar. In it there were date-palm trees and graves of the idolaters. The Prophet said to them: 'Name its price.' They said: 'We will never take any money for it.' The Prophet built it and they were assisting him, and the Prophet was saying: 'The real life is the life of the Hereafter so forgive the Ansar and the Muhajirah.' Before the mosque was built, the Prophet would perform prayer wherever he was when the time for prayer came." (Using translation from Ibn Mājah 742)
كَانَ مَوْضِعُ مَسْجِدِ النَّبِيِّ ﷺ لِبَنِي النَّجَّارِ وَكَانَ فِيهِ النَّخْلُ وَقُبُورُ الْمُشْرِكِينَ فَقَالَ لَهُمُ النَّبِيُّ ﷺ ثَامِنُونِي بِهِ فَقَالُوا لَا نَأْخُذُ لَهُ ثَمَنًا وَكَانَ النَّبِيُّ ﷺ يَبْنِيهِ وَهُمْ يُنَاوِلُونَهُ وَهُوَ يَقُولُ أَلَا إِنَّ الْعَيْشَ عَيْشُ الْآخِرَهْ فَاغْفِرْ لِلْأَنْصَارِ وَالْمُهَاجِرَهْ قَالَ وَكَانَ رَسُولُ اللهِ ﷺ يُصَلِّي قَبْلَ أَنْ يُبْنَى الْمَسْجِدُ حَيْثُ أَدْرَكَتْهُ الصَّلَاةُ