The Greek word for mammon, which appears four times in the King James New Testament, is mammonas (Strong's Concordance #G3126). It can mean money, material wealth or the personification of riches as a false deity (idol) worthy of our time and devotion.
The first time Jesus mentions mammon is in Matthew 6:24. He briefly referenced it as part of his expansive Sermon on the Mount given shortly after Pentecost in 27 A.D. The audience for his message, gathered at Mount Eremos, was a large number of people interested in hearing him speak.
The second time the Lord referenced mammon is in early 30 A.D. He used the word three times after visiting his adopted hometown of Capernaum. Although his followers were the primary audience of his words (Luke 16:1), there were also religious leaders like the Pharisees who heard him (verse 14).
No one is able to serve two masters; for either he will hate the one and love the other, or he will hold to the one and despise the other. You cannot serve God and mammon (Matthew 6:24, HBFV).
Jesus reveals that it is impossible for humans to dedicate themselves to both the Kingdom of God (eternal spiritual wealth) and the pursuit of money (temporary earthly wealth). We cannot fully pursue an intimate relationship with the true God while also serving mammon as if it were a deity.
It is indeed foolish to amass a huge fortune for our own selfish uses instead of being rich toward God (Luke 12:20 - 21). We are counseled, earlier in Matthew 6, to store our "treasure" in heaven where it is safe and does not lose value. Mammon that is accumulating and stored on earth, however, comes with real risks.
Do not store up treasures for yourselves on earth, where moth and rust spoil, and where thieves break through and steal . . . store up treasures for yourselves in heaven . . . (Matthew 6:19 - 20).
The three remaining mentions of mammon are found in Jesus' comments given after he spoke the parable of the unjust steward (shrewd manager, unfaithful steward) recorded in Luke 16:1 - 8. His use of the word in Luke 16:13 means the same as what he stated above in Matthew 6:24. This leaves two other recorded uses that are quite interesting.
And I tell you, make friends for yourselves by means of the mammon of unrighteousness; so that, when you fail, they may receive you into the age-lasting dwellings.
The one who is faithful in the things that are least is also faithful in much; and the one who is unrighteous in the things that are least is also unrighteous in much.
Therefore, if you have not been faithful in the unrighteous mammon, who will entrust to you the true riches? (Luke 16:9 - 11, HBFV).
Although Jesus calls it "the mammon of unrighteousness," he recognizes his disciples will have regular access to it and therefore encourages them to use it righteously (e.g. helping those in need). He also reveals that it functions as a training tool and a barometer of our character.
How we use mammon or worldly wealth in this life will help determine our future reward in the next. The character we build by being faithful with a few things or in things God considers "least" qualifies us to someday be rewarded with more resources of a much higher value (see Matthew 25:21 - 23, Luke 19:17). Failure to use faithfully what we have been given, however, will lessen our reward.
God is not opposed to worldly wealth (mammon) per se. It was, after all, His idea to make King Solomon the richest person in history though he did not ask for it (1Kings 3:5 - 13). He also decided to double Job's great wealth after he repented (Job 42:10 - 12).
Several Old Testament men remained faithful all their life even though they were exceedingly blessed (e.g. Abraham, Isaac, Jacob, King David). The Father even arranged for the wealthy Magi to give his beloved Son the riches (gold, frankincense and myrrh) needed to escape Herod's wrath and support his earthly family (Matthew 2:9 - 14).
What God dislikes is the obsessive pursuit of mammon for its own sake. We should, instead, trust in him to provide for our basic needs as we seek his Kingdom (Matthew 6:25 - 34). He also rejects using the blessings he makes possible in a selfish manner such as hoarding it (see Luke 12:16 - 21) or spending it to fulfill our lusts. Our priority should always be the Kingdom of God and on using the resources that come our way in a righteous manner.