The paper addresses the following question: how efficient is the market system in allocating resources if trade takes place at some prices $p$ that are not necessarily competitive? Even though there are many partial answers to this question, an answer that stands comparison to the rigor by which the first and second welfare theorems are derived is lacking. We first prove a "Folk Theorem" on the generic suboptimality of equilibria at non-competitive prices. The more interesting problem is whether equilibria are constrained optimal, i.e. efficient relative to all allocations that are consistent with prices at which trade takes place.We give a necessary condition, called the separating property, for constrained optimality: each constrained household should be constrained on each constrained market. If the number of commodities is less than or equal to two, then this necessary condition is also sufficient. In that case equilibria are constrained optimal. In all other cases, this necessary condition is typically not sufficient and equilibria are generically constrained suboptimal.