The Messenger of Allah ﷺ said, "There are three to whom Allah will not speak on the Day of Resurrection, nor will He look at them, nor will He purify them, and they shall have a painful punishment.A man who possesses surplus water in the desert and withholds it from a traveler.A man who sells goods to another after the afternoon prayer, swearing by Allah that he paid such and such a price for them, and the buyer believes him, though the matter is otherwise.And a man who pledges allegiance to a ruler purely for worldly gain. If the ruler grants him something of it, he keeps his pledge, and if he gives him nothing, he breaks it."
قال رسول الله ﷺ: ثلاث لا يكلمهم الله يوم القيامة، ولا ينظر إليهم، ولا يزكيهم، ولهم عذاب أليم: رجل على فضل ماء بالفلاة يمنعه من ابن السبيل، ورجل بايع رجلا بسلعة بعد العصر فحلف له بالله لأخذها بكذا وكذا فصدقه وهو على غير ذلك، ورجل بايع إماما لا يبايعه إلا لدنيا، فإن أعطاه منها وفى، وإن لم يعطه منها لم يف.
Bukhari related it in the Book of Sharecropping (2358), and Muslim in the Book of Faith (108), both from the hadith of Amash, from Abu Salih, from Abu Hurairah, who mentioned the hadith. The wording given here is Muslim's. Bukhari's wording is similar, but he added, "Then he recited this verse, "Indeed, those who exchange the covenant of Allah and their oaths for a small price" [Al Imran 3:77]."