Is it permissible to exchange gold for gold?
For example, the price of used gold which I buy from someone is fifty Riyals per gram, while the price of gold which he buys from me is sixty Riyals per gram. This price is different from the selling price in case of buying and selling; the gram would be sold for seventy Riyals, however, I buy it for fifty and sell it for sixty Riyals.
(Part No. 13; Page No. 478)
This is permissible on the condition that:
the two articles of exchange should be received immediately. This transaction will be impermissible in case both items or one of them is delayed as this is Riba Al-Nasi'ah (usury of delay, conditional excess for delay of payment).
You should not buy gold on the condition that the seller buys yours as this would be two sales in one transaction which the Prophet (peace be upon him) forbade.