The objective of this paper is to study optimal fiscal and monetary policy in a dynamic Mirrlees model where the frictions giving rise to money as a medium of exchange are explicitly modeled. The framework is a three period OLG model where agents are born every other period. The young and old trade in perfectly competitive centralized markets. In middle age, agents receive preference shocks and trade amongst them- selves in an anonymous manner. Since preference shocks are private information, in a record-keeping economy, the planner’s constrained allocation trades off efficient risk sharing against production efficiency in the search market. In the absence of record-keeping, the government uses flat money as a substitute for dynamic contracts to induce truthful revelation of preferences. Inflation affects agents’ incentive constraints and so distortionary taxation of money may be needed as part of the optimal policy even if lump-sum taxes are available.