  We quantify two main pathways through which baryonic physics biases cluster
count cosmology. We create mock cluster samples that reproduce the baryon
content inferred from X-ray observations. The clusters are linked to their
counterparts in a dark matter-only universe, whose abundances can be predicted
robustly, by assuming the shape of the dark matter density profile does not
change significantly due to baryons. We derive halo masses from different weak
lensing fitting methods and infer the best-fitting cosmological parameters
$\Omega_\mathrm{m}$, $S_8=\sigma_8(\Omega_\mathrm{m}/0.3)^{0.2}$, and $w_0$
from the mock cluster sample. We find that because of the need to accommodate
the change in the density profile due to the ejection of baryons, weak lensing
mass calibrations are only unbiased if the concentration is left free when
fitting the reduced shear with NFW profiles. However, even unbiased total mass
estimates give rise to biased cosmological parameters if the measured mass
functions are compared with predictions from dark matter-only simulations. This
is the dominant bias for haloes with $m_\mathrm{500c} < 10^{14.5} \, h^{-1} \,
\mathrm{M}_\odot$. For a stage IV-like cluster survey with area $\approx 15000
\, \mathrm{deg^2}$ and a constant mass cut of $m_\mathrm{200m,min} = 10^{14} \,
h^{-1} \, \mathrm{M}_\odot$, the biases are $-11 \pm 1 \, \%$ in
$\Omega_\mathrm{m}$, $-3.29 \pm 0.04 \, \%$ in $S_8$, and $9 \pm 1.5 \, \%$ in
$w_0$. These systematic biases exceed the statistical uncertainties by factors
of 11, 82, and 6, respectively. We suggest that rather than the total halo
mass, the (re-scaled) dark matter mass inferred from the combination of weak
lensing and observations of the hot gas, should be used for cluster count
cosmology.
