What you see as vanity, such as hair extensions, may be a high utility item for others. Consider the hair extensions make them a more attractive mate and provide them the opportunity to breed with a better stock, for example.
Similarly, consider that 20k ft sq mansion in context: all the prior owner(s) of that property were traded revenue for the land. And the construction workers were paid. And now the gov gets taxes.
At every step, each contributor to the end product voluntarily participated and maximized their outcomes. That is maximally efficient, economically speaking.