Sunan an-Nasa'i, Book 21, Hadith 15 (In-Book) ⓘ
It was narrated that 'Abdullah bin 'Amr said: "A man who had been born in Al-Madinah died there, and the Messenger of Allah prayed for him, then he said: 'Would that he had died somewhere other than the place where he was born.' They said: 'Why is that, O Messenger of Allah?' He said: If a man dies somewhere other than the place where he was born, a space in him equal to the distance between the place where he was born and the place where he died."
أَخْبَرَنَا يُونُسُ بْنُ عَبْدِ الأَعْلَى، قَالَ أَنْبَأَنَا ابْنُ وَهْبٍ، قَالَ أَخْبَرَنِي حُيَىُّ بْنُ عَبْدِ اللَّهِ، عَنْ أَبِي عَبْدِ الرَّحْمَنِ الْحُبُلِيِّ، عَنْ عَبْدِ اللَّهِ بْنِ عَمْرٍو، قَالَ مَاتَ رَجُلٌ بِالْمَدِينَةِ مِمَّنْ وُلِدَ بِهَا فَصَلَّى عَلَيْهِ رَسُولُ اللَّهِ صلى الله عليه وسلم ثُمَّ قَالَ " يَا لَيْتَهُ مَاتَ بِغَيْرِ مَوْلِدِهِ " . قَالُوا وَلِمَ ذَاكَ يَا رَسُولَ اللَّهِ قَالَ " إِنَّ الرَّجُلَ إِذَا مَاتَ بِغَيْرِ مَوْلِدِهِ قِيسَ لَهُ مِنْ مَوْلِدِهِ إِلَى مُنْقَطَعِ أَثَرِهِ فِي الْجَنَّةِ " .
also referenced under: Hadith 1832 (Reference) & Volume 3, Book 21, Hadith 1833 (DarusSalam)