THE leaders of the failed coup in Moscow said a central purpose of their actions was to relieve the Soviet Union's shortage of food and housing. How would they have done it? By opening warehouses? That would have been a palliative at best. By ordering soldiers to help with the harvest? If the coup had lasted, most soldiers would have been otherwise occupied.In truth, the men who tried to shunt Mikhail Gorbachev aside didn't have a clue. Communist planning, while able to quickly industrialize a society at extreme costs in human rights and lives, has proven itself utterly unable to distribute resources and goods within a complex economy. The only mechanism for doing that is a free market. Such a market is stirring in the land of Lenin. A "shadow economy," with small entrepreneurs selling everything from computers to potatoes, fills the gap for many Soviet consumers who find the shelves empty in state-run stores. Coup leaders might have tried to crack down on these "economic saboteurs and would thus have exposed the real saboteurs, the old-line Marxists themselves. Mr. Gorbachev knows a free market has to be encouraged, but in the past he has tried to implement the new economics without offending, too sharply, the old dogmas. It was an impossibility, and he should be returning to Moscow wiser about such matters. When it came to the most critical economic reform of all - private property, no strings attached - Gorbachev has tended to equivocate. But what the Soviet economy needs by the bushelful are incentives for people to work hard because they know the rewards wi ll be theirs. The coup further damaged the economy it hoped to salvage. Western investments and aid are in cold storage. Such outside help has so far had a relatively small impact on the Soviet economy. But the $3 billion already invested in 2,000 Soviet firms is essential seed money. Much more is needed. Men like Boris Yeltsin and his economic advisers want to move unreservedly toward a free market. Particularly after the coup, they may have the popular support needed to push ahead with the sometimes painful reforms required if a vigorous free market is ever to emerge from the shadows.