"The Prophet would not pray for a man who owed a debt. A deceased person was brought to him and he said: 'Does he owe any debt?' They said: 'Yes, he owes two Dinars.' He said: 'Pray for your companion.' Abu Qatadah said: 'I will pay them, O Messenger of Alllah, So he prayed for him. Then, when Allah made His Messenger rich though conquest, he said: ' I am closer to each believer than his own self. Whoever leaves behind a debt, I will pay it, and whoever leaves behind wealth, it is for his heirs." (Using translation from Nasāʾī 1962)
كَانَ النَّبِيُّ ﷺ لَا يُصَلِّي عَلَى رَجُلٍ عَلَيْهِ دَيْنٌ فَأُتِيَ بِمَيِّتٍ فَسَأَلَ هَلْ عَلَيْهِ دَيْنٌ؟ قَالُوا نَعَمْ دِينَارَانِ قَالَ صَلُّوا عَلَى صَاحِبِكُمْ فَقَالَ أَبُو قَتَادَةَ هُمَا عَلَيَّ يَا رَسُولَ اللهِ فَصَلَّى عَلَيْهِ فَلَمَّا فَتَحَ اللهُ عَلَى رَسُولِهِ ﷺ قَالَ أَنَا أَوْلَى بِكُلِّ مُؤْمِنٍ مِنْ نَفْسِهِ فَمَنْ تَرَكَ دَيْنًا فَعَلَيَّ وَمَنْ تَرَكَ مَالًا فَلِوَرَثَتِهِ