It is narrated from Riyah bin Ubaydah (may Allah have mercy on him) that a man sent ten dinars with a man from the people of Basrah to a man in Madinah. The man with whom it was sent bought a camel with it, then sold it for eleven dinars. He asked Sayyiduna Abdullah bin Umar (may Allah be pleased with them both), and he said: "The eleven dinars belong to the owner of the money, and had anything happened to the camel, he would have been liable for it."
Imam al-Shafi'i (may Allah have mercy on him) said: Sayyiduna Ibn Umar (may Allah be pleased with them both) held that the one who buys with goods belonging to someone else is liable, and he held that the profit belongs to the owner of the goods, and he did not give the profit to the one who was liable. Al-Rabi' said: The final view of Imam al-Shafi'i (may Allah have mercy on him) is that if he transgresses and buys something with that very money and makes a profit on it, the purchase is void; but if he buys for an unspecified sum and then pays with that money, the purchase is his, the profit is his and the loss is upon him, and he is liable for the money. Al-Muzani reported the same, and then said: He argued that the hadith of al-Bariqi is not established in his view. The Shaykh said: That is because of the irsal (break) in its chain: Shabib bin Gharqadah did not hear it from Urwah al-Bariqi; he only heard it from the tribe reporting it from him; and the hadith of Hakim bin Hizam is likewise from a shaykh of the people of Madinah, from him. Al-Muzani interpreted the hadith of Sayyiduna Umar (may Allah be pleased with him) with his two sons as meaning that he asked them, out of the filial duty they owed him, to give all of its profit to the Muslims; they did not accept, and when he asked for half, they accepted willingly.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب القراض / 11620