Abu Saeed Khudri reported,

Bilal came to the Prophet ﷺ with some Barni dates. The Prophet ﷺ asked him, "Where did these come from?"Bilal replied, "I had some poor-quality dates, so I sold two measures of them for one measure of these to feed the Prophet ﷺ."At that, the Prophet ﷺ said, "Oh no, oh no! This is the very essence of riba. Do not do this. Rather, when you want to buy good dates, sell your dates in a separate transaction, then use the proceeds to buy what you want."

Azami 5712

Sahih

عن أبي سعيد الخدري قال

جاء بلال إلى النبي ﷺ بتمر برني، فقال له النبي ﷺ من أين هذا؟ قال بلال: كان عندي تمر رديء، فبعت منه صاعين بصاع النطعم النبي ﷺ، فقال النبي ﷺ عند ذلك: أوه، أوه، عين الربا، لا تفعل، ولكن إذا أردت أن تشتري فبع التمر ببيع آخر، ثم اشتريه.

الأعظمي 5712صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Sales
Chapter
Prohibited sales
Section
Prohibition of selling dates for dates or food for food with surplus
Numbering
Jami al-Kamil 5712 (2nd edition)
Azami 5712