The narration does not condemn lawful wealth as such. It warns of a society in which money, status, and publicity eclipse trustworthiness and moral competence. It is equally wrong to assume every poor person is righteous or every wealthy person corrupt.
Example: A prominent but unreliable candidate and a less famous, competent, trustworthy candidate seek a position of responsibility. Relevant ability and verified conduct should outweigh status alone.
The qualification بِالدُّنْيَا is a reminder not to confuse worldly standing with moral or spiritual standing.