This is true for both your internal spiritual journey as well as the external social journey in life. Wealth is an indicator of greed, which is one of the five known obstacles to the pathway of self-realization.
Greed according to the Patanjali is defined as possessing any material wealth more than your need.
Greed in turn is linked to attachment through any of the five senses and uncontrolled desires. Once desires are fulfilled more desires are created, which is nothing but greed. And when the desires are not fulfilled then greed gets converted into anger, which leads to loss of intellect and ultimately destruction of the body.
Lord Krishna, in the Bhagavad Gita, while explaining this to Arjuna has clearly mentioned the pathway of self destruction starting from attachment to loss of intellect and ultimately destruction of the self.
The Hindu mythology has always said that never be after money. When you are after money the knowledge or wisdom will not follow you. The classical example given is that if you are after Saraswati (God of Knowledge), Laxmi (God of Wealth) follows you and if you are after Laxmi, Saraswati may not remain with you.
God is representative of your true self and that is your consciousness, which is nothing but “Satchitananda” or the triad of truthfulness, consciousness based decisions and internal bliss or happiness. To be in touch with your consciousness you have to control your five senses through your mind and detach yourself from the egocentric desires.
Greed and wealth are representatives of attachment to the material world through one of your five senses, therefore, if you want to be in touch with your consciousness you have to be detached from the materialistic world and wealth is one of them.
There is a classical description of this phenomenon in Mahabharata in the battle of Kurukshetra when Lord Krishna became the Sarathi of Arjuna and rode the five horses chariot. The symbolic representation of the whole thing is, Lord Krishna represents your true self or consciousness; Arjuna represents the ego and the intellect; the reins of the horses represent the unstable mind and five horses represent the ever changing five senses.
Using your ego and intellect if you can tighten your mind (reins), you will be able to control the five horses (the five senses) and then you will have all the time in the world to be with Lord Krishna (your own consciousness). On the other hand, if you let the reins loose (let the mind wonder) all the horses (senses) will get uncontrolled and wander here and there (one gets attached to the materialistic world). The mind and the intellect, instead of becoming the master, then becomes the servant of the five senses and will get detached from the true self or the consciousness.
Electricity is a good servant and a bad master is a well-known saying. Something is true for the five senses. They are very good to the life provided they are controlled like servants and never treated like masters. Once they overpower you, they will create an umbrella of darkness over the mind and the intellect making you forget about the presence of soul in the body. Once this happens, you lose your dharma.
Whenever given a choice, always choose your consciousness as the master and not any of the five senses, mind, intellect or ego.