The extravagance that is forbidden is the one in which there’s excess beyond what is acceptable. That is, buying that exceeds what is necessary even though it is in a lawful thing. This is considered as an extravagance. It is different from the profligacy which occurs when buying unlawful things. Concerning wastefulness, Allah, the most high, says:

O children of Adam, take your adornment at every masjid, and eat and drink, but be not excessive. Indeed, He likes not those who commit excess. [Quran 7 : 31 ]

As the adage says: Anything that exceeds its limit has become its opposite.