The history of market economies tends to show that they are unstable. There is a strong tendency for nearly all resources to accrue to a few, and that destabilizes the society. The ancient Mesopotamians dealt with this with occasional cancellations of all consumer debts, an idea taken over by Judaism in such traditions as jubilee. Those techniques are pretty disruptive on their own account, since credit is going to dry up any time a forgiveness looms.
The Egyptians invented another method, or so I hypothesize. I call it the Old or Original Keynesian method. The essential idea is to employ, feed, etc. agricultural workers by having them erect vast public works in the off season - originally pyramids, but later other works. This distributed the surplus accumulated by the wealthy, and kept the populace fed and out of trouble. Similar devices were employed by subsequent civilizations, and the Romans even improved on the idea by building useful public works: roads, aqueducts, fortification, and so on. Of course they also depended heavily on warfare, which might have been one reason that their civilization proved so much less enduring.
Subsequent civilizations have adapted similar tactics, not always with happy. Cathedrals were pretty harmless, but as Wolfgang has pointed out, the public works projects of the Easter Islanders may have hastened their cultural collapse.
Nowadays Keynesian ideas are again having a tough time, mostly because they are counter-intuitive, and a lot of people still believe that anything which doesn't match their intuition must be wrong.