Many scarce public resources are allocated at below-market-clearing prices and sometimes for free. Such "nonmarket" mechanisms sacrifice some surplus, yet they can potentially improve equity. We develop a model of mechanism design with redistributive concerns. Agents are characterized by a privately observed willingness to pay for quality, a publicly observed label, and a social welfare weight. A market designer controls allocation and pricing of a set of objects of heterogeneous quality and maximizes the expectation of a welfare function. The designer does not directly observe individuals' social welfare weights. We derive structural insights about the form of the optimal mechanism, leading to a framework for determining how and when to use nonmarket mechanisms.