The measures of how well an economy is working is not "how much money is in the system", but "how much money is moving", and "how much of the economic system does that money reach?". Money that does not move does not do work, and people that do not give and receive money are not part of the economic system.
Consider two hydraulic systems. One has a massive 200L of hydraulic fluid since it leaks so much, but most of it is in a reservoir, and it only produces 10N of work on a small 10cm^2 area. The other has only 1L of hydraulic fluid, but it reaches pressures of 10Pa, doing several kilonewtons of work.
Which one is working better? Obviously the second one.
Oil-based Middle-Eastern economies are like the first one. They may make a lot of money, but only a few people get that money or its benefits, and the money leaks out of the country almost immediately.
A good economy is like America's, or Germany's (and yes, these economies are relatively good - could be better, but good). The money does pool around the rich, but not nearly as much (most of the "wealth" of the ultra-rich is in assets, not cash), and the trade with foreign countries is mostly balanced. Mostly. And there are very few people who do not participate in the economy - even people on welfare get money, then spend it. They're idle parts in the machine, but still part of the machine.
ISIS thrives because they're getting money in from elsewhere (coughsaudiarabiacough), and getting the cheapest possible people you can.