Whenever you sell one of these items for the very same kind, two conditions must be met: equality and mutual possession before the parties separate. Thus, if you sell gold for gold, the weights must be identical and each party must take possession before parting. The same applies to silver for silver: equal weight and hand-to-hand exchange before separation. If wheat is traded for wheat, the measures must be equal and possession effected on the spot; the identical rule governs barley for barley, dates for dates, and salt for salt—equality in measure and immediate delivery on both sides.
That is the ruling when an item is bartered for its own genus among these six categories. When it is exchanged for a different genus, equality is no longer a condition, yet immediate mutual possession before separation remains obligatory. Selling one measure of wheat for two measures of barley, for instance, is permissible, provided the transfer of possession occurs on the spot. The same holds true when one measure of dates is exchanged for two measures of barley, or when gold is traded for silver with a surplus or deficiency on either side—such transactions are lawful so long as the exchange is hand-to-hand before the parties part.
These are the six commodities about which the Messenger of Allah, blessings and peace be upon him, explicitly ruled that riba applies. Anything that shares their operative cause is accorded the same legal status, for Islamic law neither differentiates between things that are truly alike nor equates things that are fundamentally distinct.