Praise be to Allah.
There are many hadiths from the Prophet (blessings and peace of Allah be upon him) which describe the types of riba, including the hadith of ‘Ubaadah ibn as-Saamit (may Allah be pleased with him), who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Gold for gold, silver for silver, wheat for wheat, barley for barley, dates for dates, salt for salt, like for like, same for same, hand to hand. But if these commodities differ, then sell as you like, so long as it is hand to hand.” Narrated by Muslim (1587).
Giving loans is permissible and is recommended, according to the consensus of the Muslims, whether it involves the types of wealth that are subject to riba or others.
Ibn al-Qattaan said in al-Iqna‘ fi Masaa’il al-Ijmaa‘ (p. 197): All of the scholars from whom I acquired knowledge are unanimously agreed that borrowing dinars and dirhams, wheat, barley, dates, gold and similar types of food that are weighed and measured is permissible. End quote.
The questioner is confused by the fact that it is a loan of gold for gold, and thinks that it is a type of exchanging a kind of wealth that is subject to riba when the exchange does not take place on the spot.
The response to that includes noting several points:
1.. The texts which stipulate that the exchange occur on the spot, “hand to hand,” only refer to buying and selling: “then sell as you like.” There is no mention here of loans.
2.. The loan is intended to be an act of kindness and help, in contrast to a sale or transaction, which is an exchange of wealth without anything to be returned later on.
Ibn al-Qayyim said in I‘laam al-Muwaqqi‘een ‘an Rabb al-‘Aalameen (2/11): With regard to loans, those who say that the loan is an exception to the ruling are mistaken in thinking of the loan as an exchange of wealth of the same type that is subject to riba, without the exchange taking place on the spot. This is mistaken, because the loan is a kind of giving some wealth to someone else, so that the latter may benefit from it and then return it. Hence the Prophet (blessings and peace of Allah be upon him) called it a maneehah (an item loaned as a favour), as he said: “Whoever gives a maneehah of gold or a maneehah of silver…” This comes under the heading of showing kindness and helping, not of exchanging wealth. Buying and selling is based on the idea of exchanging wealth that is not taken back, whereas loans come under the heading of lending and maneehah … this has nothing to do with the idea of buying and selling; rather it comes under the heading of showing kindness, and giving gifts or charity. End quote.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said in ash-Sharh al-Mumti‘ ‘ala Zaad al-Mustaqni‘ (9/93): it is a kind of deal based on kindness and for the purpose of helping, in which the borrower is temporarily given possession of the borrowed item. In other words, you temporarily give possession of what you give as a loan to the man who borrows it. … thus it is a transaction for the purpose of helping, and it is not intended as an exchange or to make a profit; rather it is based on pure kindness. Hence it is permissible to give a loan on this basis, even though it may look like a riba-based transaction, because if a man sells a dirham for a dirham but the exchange does not take place on the spot, then it is riba, but if he lends him a dirham and a month later he returns it to him, that is not riba even though it may look like riba, and the only difference is the intention behind this process. As for the purpose of the loan, it is to help and show kindness to another, and it is permissible.
3.. It is known that people have been lending money, dirhams, dinars and all kinds of wealth and items, such as barley and camels, to one another, and paying back with the same calibre of wealth, since the time of the Prophet (blessings and peace of Allah be upon him) until the present day, and nobody said that this is riba. It was narrated that ‘Aa’ishah (may Allah have mercy on her) said: The Messenger of Allah (blessings and peace of Allah be upon him) bought some food on credit from a Jew, and he gave him an iron shield of his as collateral (rahn). Narrated by al-Bukhaari (2251) and Muslim (1603) – and barley is one of the types of wealth that are subject to riba.
If we were to stipulate that the exchange take place on the spot in the case of loans, there would be no lending of any of the types of wealth that are subject to riba.
And Allah knows best.