Explain how the law of demand and prices work to determine production and distribution in a market economy.