Breeding success generally increases with environmental productivity, but little is known about underlying mechanisms, and such relationships are not quantitatively understood. We studied female mice reproducing across an experimental environmental-quality gradient defined by the amount of wheel running required to obtain a food reward. Measuring energy metabolism with doubly labeled water, we quantified how mice made two key decisions: how much food to earn and how to allocate the energy earned between self and offspring. As environmental quality declined, female foraging effort increased, but not sufficiently to compensate for the increase in foraging costs. In absolute terms, energy allocated to both self and offspring was lower in a poor-quality environment. Moreover, the proportion of gained energy that was allocated to offspring declined with decreasing environmental quality. Environmental effects on reproductive output (total litter mass produced) could be fully explained by energy allocated to milk. Thus, the efficiency with which offspring converted milk energy to tissue growth was independent of environmental quality. To the best of our knowledge, this is the first study to provide a quantitative explanation, via maternal energy allocation, of the link between foraging costs and reproductive output.