كتاب البيوع
21  
The Book of Transactions
(8)
Chapter: It is invalid to sell goods before taking possession of them
(8)
باب بُطْلاَنِ بَيْعِ الْمَبِيعِ قَبْلَ الْقَبْضِ ‏‏
Sahih Muslim 1527 c

Ibn 'Umar (Allah be pleased with them) reported that they were beaten during the lifetime of Allah's Messenger (ﷺ) if they had bought foodgrains in bulk and then sold them in the spot without shifting them (to some other place).

حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا عَبْدُ الأَعْلَى، عَنْ مَعْمَرٍ، عَنِ الزُّهْرِيِّ، عَنْ سَالِمٍ، عَنِ ابْنِ عُمَرَ، أَنَّهُمْ كَانُوا يُضْرَبُونَ عَلَى عَهْدِ رَسُولِ اللَّهِ صلى الله عليه وسلم إِذَا اشْتَرَوْا طَعَامًا جِزَافًا أَنْ يَبِيعُوهُ فِي مَكَانِهِ حَتَّى يُحَوِّلُوهُ ‏.‏
Reference : Sahih Muslim 1527c
In-book reference : Book 21, Hadith 45
USC-MSA web (English) reference : Book 10, Hadith 3649
  (deprecated numbering scheme)