Zakah on grains and fruits: is it to be paid by the seller or the buyer?
Question

A man planted some wheat in the desert, and Allah, may He be glorified and exalted, willed that there should be no rain, and the crops did not grow in a way that could produce any grains. So the one who had cultivated it sold some of the crop to a man who owned livestock, for use as animal food. Then the purchaser found some grains on part of the land that were fit to be harvested and reached the minimum threshold at which zakah becomes due. Should the zakah be paid by the one who planted then sold the crop, or should it be paid by the one who bought the crop as food for his livestock?
Praise be to Allah.Zakah on grains is due from the one who owned the crop at the time when the grains became ripe. 
Ibn Qudaamah (may Allah have mercy on him) said in al-Mughni (2/300): 
The time when zakah becomes due on grains is when the grain becomes ripe, and on fruits it is when they become ripe and sound. If a person disposes of the fruit or grains before they are ripe, then he does not have to pay anything, because he disposed of it before zakah became due. This is like the one who eats livestock or sells them before one year has passed. End quote. 
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said in ash-Sharh al-Mumti‘ (6/80): When the grain becomes ripe  or fruit becomes ripe and sound, zakah becomes due; before that it is not due. Based on that, if ownership is transferred from one person to another before zakah becomes due, then it is not due from him (the original owner); rather it is due from the one to whom ownership was transferred, such as if the owner dies before zakah becomes due or before the grain becomes ripe or the fruit becomes ripe and sound, then no zakah is due from him, but it is due from his heir. Similarly, if a person sells palm trees on which there is fruit that has not yet been seen to be sound, or he sells land on which there are crops, the grains of which have not yet ripened, then zakah is due from the purchaser, because it passed from ownership (of the seller) before zakah became due. End quote. 
Based on that, if the sale was done before zakah became due – which in the case of grains is before they ripen – then zakah is due from the buyer. But if he sold the grains after they became ripe, then zakah is due from the seller, because it became his responsibility before the sale. 
And Allah knows best.