It was narrated from Abu Hurairah that the Prophet (ﷺ) said: “Any man who sells a product with the man who has become bankrupt, and he has not taken any of its price, it belongs to him, but if he had taken any of its price, then he is like any other creditor.”
Source: sunnah.com
Other translations
Arabic
حَدَّثَنَا هِشَامُ بْنُ عَمَّارٍ، حَدَّثَنَا إِسْمَاعِيلُ بْنُ عَيَّاشٍ، عَنْ مُوسَى بْنِ عُقْبَةَ، عَنِ الزُّهْرِيِّ، عَنْ أَبِي بَكْرِ بْنِ عَبْدِ الرَّحْمَنِ بْنِ الْحَارِثِ بْنِ هِشَامٍ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ " أَيُّمَا رَجُلٍ بَاعَ سِلْعَةً فَأَدْرَكَ سِلْعَتَهُ بِعَيْنِهَا عِنْدَ رَجُلٍ وَقَدْ أَفْلَسَ وَلَمْ يَكُنْ قَبَضَ مِنْ ثَمَنِهَا شَيْئًا فَهِيَ لَهُ . وَإِنْ كَانَ قَبَضَ مِنْ ثَمَنِهَا شَيْئًا فَهُوَ أُسْوَةُ الْغُرَمَاءِ " .
sunnah.com