All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
This middleman may buy the item for himself for 90 first and then sell it to the person who asked it for 100, and there is no problem in that. However, if he buys the item for the person who asked for it, acting as his agent, then it is illegal for him to take the 10 except with the permission and consent of the buyer. If the buyer knows of this (that the middleman will take the difference in price) either by agreement or according to the common practice, then there is no harm in taking this extra 10.
However, if this middleman buys the required item as an agent and the buyer does not know that he bought it for 90 and would not approve giving him the difference in price, then it is not allowed for the middleman to take the 10. If he conceals it from the buyer, then he bears a sin for it and is considered to be consuming people's wealth unjustly. Allah, The Exalted, says (what means): {O you who have believed, do not consume one another's wealth unjustly but only (in lawful) business by mutual consent...} [Quran 4:29] The Prophet, sallallahu ‘alayhi wa sallam, said, “Whoever cheats us is not one of us.” [Muslim]
‘Urwah ibn Al-Ja‘d Al-Baariqi, may Allah be pleased with him, narrated that the Prophet, sallallahu ‘alayhi wa sallam, gave him one dinar to buy a sheep for him. ‘Urwah bought two sheep for him with the money. Then he sold one of the sheep for one dinar and brought one dinar and a sheep to the Prophet, sallallahu ‘alayhi wa sallam. On that, the Prophet, sallallahu ‘alayhi wa sallam, invoked Allah to bless him in his deals. [Al-Bukhari]
The version cited by Ahmad reads, “I said, 'O Messenger of Allah, here is your dinar, and here is your sheep.’” This indicates that the agent does not own the difference in price; rather, it is for the person who assigned him to conduct the sale on his behalf.
Allah knows best.