Malik related to me from Humayd ibn Qays al-Makki that Mujahid said, "Abdullah ibn Umar borrowed some dirhams from a man, then he discharged his debt with dirhams better than them. The man said, 'Abu Abdar-Rahman. These are better than the dirhams which I lent you.' Abdullah ibn Umar said, 'I know that. But I am happy with myself about that.' " Malik said, "There is no harm in a person who has borrowed gold, silver, food, or animals, taking to the person who lent it, something better than what he lent, when that is not a stipulation between them nor a custom. If that is by a stipulation or promise or custom, then it is disapproved, and there is no good in it." He said, "That is because the Messenger of Allah ﷺ discharged his debt with a good camel in its seventh year in place of a young camel which he borrowed, and Abdullah ibn Umar borrowed some dirhams, and repaid them with better ones. If that is from the goodness of the borrower, and it is not by a stipulation, promise, or custom, it is halal and there is no harm in it."
فَقَالَ الرَّجُلُ يَا أَبَا عَبْدِ الرَّحْمَنِ هَذِهِ خَيْرٌ مِنْ دَرَاهِمِي الَّتِي أَسْلَفْتُكَ فَقَالَ عَبْدُ اللَّهِ بْنُ عُمَرَ قَدْ عَلِمْتُ وَلَكِنْ نَفْسِي بِذَلِكَ طَيِّبَةٌ قَالَ مَالِكٌ لاَ بَأْسَ بِأَنْ يُقْبِضَ مَنْ أُسْلِفَ شَيْئًا مِنَ الذَّهَبِ أَوِ الْوَرِقِ أَوِ الطَّعَامِ أَوِ الْحَيَوَانِ مِمَّنْ أَسْلَفَهُ ذَلِكَ أَفْضَلَ مِمَّا أَسْلَفَهُ إِذَا لَمْ يَكُنْ ذَلِكَ عَلَى شَرْطٍ مِنْهُمَا أَوْ عَادَةٍ فَإِنْ كَانَ ذَلِكَ عَلَى شَرْطٍ أَوْ وَأْىٍ أَوْ عَادَةٍ فَذَلِكَ مَكْرُوهٌ وَلاَ خَيْرَ فِيهِ قَالَ وَذَلِكَ أَنَّ رَسُولَ اللَّهِ ﷺ قَضَى جَمَلاً رَبَاعِيًا خِيَارًا مَكَانَ بَكْرٍ اسْتَسْلَفَهُ وَأَنَّ عَبْدَ اللَّهِ بْنَ عُمَرَ اسْتَسْلَفَ دَرَاهِمَ فَقَضَى خَيْرًا مِنْهَا فَإِنْ كَانَ ذَلِكَ عَلَى طِيبِ نَفْسٍ مِنَ الْمُسْتَسْلِفِ وَلَمْ يَكُنْ ذَلِكَ عَلَى شَرْطٍ وَلاَ وَأْىٍ وَلاَ عَادَةٍ كَانَ ذَلِكَ حَلاَلاً لاَ بَأْسَ بِهِ