In Ayah 37 Allah subhanahu wa ta’ala mentions the misers who do not spend at all, here He is talking about those who spend to show off to gain the reputation that they are generous. They do so to look good in the eyes of people and not for the pleasure of Allah.
A Hadith states that the first three persons on whom the fire will feed are a scholar, a fighter and a spender who shows off with their actions. For instance: The wealthy will say, “I did not leave any area that You like to be spent on, but I spent on it in Your cause.” Allah will say, “You lie, you only did that so that it is said, `He is generous.’ And it was said…” meaning you acquired your reward in the life, and this is indeed what you sought with your action.
This is why Allah said,
meaning, it is Shaytan who lured them to commit this evil action, instead of performing the good deed as it should be performed. Shaytan encouraged, excited and lured them by making the evil appear good,
Allah subhanahu wa ta’ala then says in Ayah 39,
This Ayah means, what harm would it cause them if they believe in Allah, go on the righteous path, replace showing off with sincerity, have faith in Allah, and await His promise in the Hereafter, for those who do good and spend what He has given them on what He likes and is pleased with. Allah subhanahu wa ta’ala then ends this Ayah with the statement,
He has perfect knowledge of our intentions, whether good or evil. Indeed, Allah knows those who deserve success, and He grants them success and guidance, directing them to perform righteous actions that will earn them His pleasure. He also knows those who deserve failure and expulsion from His great mercy, which amounts to utter failure in this life and the Hereafter for them, we seek refuge in Allah from this evil end.