  We show that photoevaporation of small gaseous exoplanets ("mini-Neptunes")
in the habitable zones of M dwarfs can remove several Earth masses of hydrogen
and helium from these planets and transform them into potentially habitable
worlds. We couple X-ray/extreme ultraviolet (XUV)-driven escape, thermal
evolution, tidal evolution and orbital migration to explore the types of
systems that may harbor such "habitable evaporated cores" (HECs). We find that
HECs are most likely to form from planets with $\sim 1 M_\oplus$ solid cores
with up to about 50% H/He by mass, though whether or not a given mini-Neptune
forms a HEC is highly dependent on the early XUV evolution of the host star. As
terrestrial planet formation around M dwarfs by accumulation of local material
is likely to form planets that are small and dry, evaporation of small
migrating mini-Neptunes could be one of the dominant formation mechanisms for
volatile-rich Earths around these stars.
