The Messenger of Allah ﷺ said, "If a man loses his property or has it stolen and then finds it in the hands of someone selling it, he has the greater right to it, and the buyer may recover the price from the seller."
حدثنا علي بن محمد حدثنا أبو معاوية حدثنا حجاج عن سعيد بن عبيد بن زيد بن عقبة عن أبيه
قال رسول الله ﷺ إذا ضاع للرجل متاع أو سرق له متاع فوجده في يد رجل يبيعه فهو أحق به ويرجع المشتري على البائع بالثمن
[Its isnad is daif] Bayhaqi narrated it, 6/51, from the hadith of Abu Muawiya, who said, Hajjaj bin Artah narrated to us, with this wording. Busiri graded it daif, and see hadith 496 and 1129 for its defect.