The market value of outstanding government debt reflects the expected present discounted value of current and future primary surpluses. When the discount rate is consistent with the term structure of interest rates and equity prices and government spending growth dynamics are estimated from the data, a government risk premium puzzle emerges. Since tax revenues are pro-cyclical while government spending is counter-cyclical, the tax revenue claim has a higher risk premium and a lower value than the spending claim. This makes the value of the surplus claim negative, and implies that the U.S. government should be a creditor rather than a debtor. We resolve this puzzle by postulating a small but persistent component in expected spending growth, and infer it from the market value of the outstanding government bond portfolio. This component offsets the pro-cyclical movements in current surpluses, reducing its risk and increasing its value. The resulting model is used to study the optimal maturity structure of government debt, and to quantify deviations of the observed portfolio from the optimal one.