This paper identifies a cost of using the price system and from that develops a general theory of allocation. The theory explains why a buyer's stochastic purchasing behavior matters to a seller. This leads to a theory of optimal customer mix much akin to the theory of optimal portfolio composition. It is the job of a firm's marketing department to put together this optimal customer mix. A dynamic pattern of pricing related to Ramsey pricing emerges as the efficient pricing structure. Price no longer equals marginal cost and is no longer the sole mechanism used to allocate goods. It is optimal for long term relationships to emerge between buyers and sellers and for sellers to use their knowledge about buyers to ration goods during periods when demand is high. This rationing cam take the form of refusing to sell to new customers and putting established customers on quotas. The evidence shows that this form of rationing, though foreign to the thinking of most economists, characterizes several industries. The theory provides an important incentive for a firm to exist, namely to facilitate trade amongst its customers. The theory also provides a convincing explanation f or the hostility that new futures markets face from established firms in the industry and shows that several practices, like price differences amongst consumers and swapping product with rivals, can be the result of competition and not market power.