He—may Allah have mercy on him—was asked:
About selling sugar cane, taro, turnips, carrots, and similar crops while they are still in the ground, and about selling melons and similar crops grown in patches.
He replied:
Praise be to Allah, Lord of all worlds. There is no objection to selling sugar cane except the concern raised about its being enclosed in its protective rind. Selling it is thus like selling walnuts, almonds, and broad beans with both their coverings intact. Selling these is permissible according to the vast majority of Muslim scholars. This is the view of the early generations of the Muslim community and its uninterrupted practice from the time of the Companions of the Messenger of Allah, may Allah bless him and grant him peace, until the present. People’s needs cannot be fully met otherwise.
This is the position of Abū Hanīfa, Mālik, and Ahmad ibn Hanbal, and one view within the school of al-Shāfiʿī. Indeed, when al-Shāfiʿī fell ill, he instructed that fresh green broad beans be purchased for him. This was during his final illness, so it came after the prohibition recorded in his books.
Further evidence for this is the report that he, may Allah bless him and grant him peace,
“forbade selling grapes until they turn black, and selling grain until it hardens.”
This indicates that selling them is permissible once the grapes have turned black and the grain has hardened. It therefore indicates that it is permissible to sell grain while it is still in its ears