  We investigate the spatial distribution of the baryonic and non-baryonic mass
components in a sample of 66 virialized systems. We have used X-ray
measurements to determine the deprojected temperature and density structure of
the intergalactic medium and have employed these to map the underlying
gravitational potential. In addition, we have measured the deprojected spatial
distribution of galaxy luminosity for a subset of this sample, spanning over 2
decades in mass. With this combined X-ray/optical study we examine the scaling
properties of the baryons and address the issue of mass-to-light (M/L) ratio in
groups and clusters of galaxies. We measure a median mass-to-light ratio of 224
h70 M/L (solar) in the rest frame B_j band, in good agreement with other
measurements based on X-ray determined masses. There is no trend in M/L with
X-ray temperature and no significant trend for mass to increase faster than
luminosity: M \propto \L_{B,j}^{1.08 +/- 0.12}. This implied lack of
significant variation in star formation efficiency suggests that gas cooling
cannot be greatly enhanced in groups, unless it drops out to form baryonic dark
matter. Correspondingly, our results indicate that non-gravitational heating
must have played a significant role in establishing the observed departure from
self-similarity in low mass systems. The median baryon fraction for our sample
is 0.162 h70^{-3/2}, which allows us to place an upper limit on the
cosmological matter density, Omega_m <= 0.27 h70^{-1}, in good agreement with
the latest results from WMAP. We find evidence of a systematic trend towards
higher central density concentration in the coolest haloes, indicative of an
early formation epoch and consistent with hierarchical formation models.
