Abu Huraira (may Allah be pleased with him) reports: The Messenger of Allah (peace and blessings be upon him) said: "If a person finds his property with someone who has been declared bankrupt, then the owner of the property has more right to it than others."
Brief Explanation
(Commentary on Hadith 2625)
When a person buys something from someone, or takes a loan, and before making payment he becomes bankrupt and destitute, and that item is found with him exactly as it was, then the original owner has the greatest right to it, and the other creditors have no right to it. However, if that item has changed—for example, if he bought gold and made it into jewelry—then all the creditors have equal right to it.
This is the position of Imam Bukhari and Imam Shafi'i rahimahumullah, but the Hanafis have said the opposite, which is not correct.