The gas fractions of dark matter haloes hosting simulated $\sim L^\star$
  galaxies are governed by the feedback history of their black holes
  We examine the origin of scatter in the relationship between the gas fraction
and mass of dark matter haloes hosting present-day $\sim L^\star$ central
galaxies in the EAGLE simulations. The scatter is uncorrelated with the
accretion rate of the central galaxy's black hole (BH), but correlates strongly
and negatively with the BH's mass, implicating differences in the expulsion of
gas by active galactic nucleus feedback, throughout the assembly of the halo,
as the main cause of scatter. Haloes whose central galaxies host undermassive
BHs also tend to retain a higher gas fraction, and exhibit elevated star
formation rates (SFRs). Diversity in the mass of central BHs stems primarily
from diversity in the dark matter halo binding energy, as these quantities are
strongly and positively correlated at fixed halo mass, such that $\sim L^\star$
galaxies hosted by haloes that are more (less) tightly-bound develop central
BHs that are more (less) massive than is typical for their halo mass.
Variations in the halo gas fraction at fixed halo mass are reflected in both
the soft X-ray luminosity and thermal Sunyaev-Zel'dovich flux, suggesting that
the prediction of a strong coupling between the properties of galaxies and
their halo gas fractions can be tested with measurements of these diagnostics
for galaxies with diverse SFRs but similar halo masses.
