There has been a belief that with the directing power of the market, the efficient state of a resource-allocating system can eventually be reached even in a case where the resource is distributed in a biased way. To mimic the realistic huge system for the resource allocation, we designed and conducted a series of economic experiments. From the experiments we found that efficient allocation can be realized despite a lack of communications among the participants or any instructions to them. To explain the underlying mechanism, an extended minority game model called the market-directed resource allocation game (MDRAG) is constructed by introducing heterogeneous preferences into the strategy-building procedures. MDRAG can produce results in good agreement with the experiments. We investigated the influence of agents' decision-making capacity on the system behavior and the phase structure of the MDRAG model as well. A number of phase transitions are identified in the system. In the critical region, we found that the overall system will behave in an efficient, stable, and unpredictable mode in which the market's invisible hand can fully play its role.