  Knowledge about the shape of the mass spectrum of compact stars helps in
breaking the degeneracy between the mass and redshift of the gravitational wave
(GW) sources and can be used to infer cosmological parameters in the absence of
redshift measurements obtained from electromagnetic observations. In this paper
we study the achievable accuracy and the limits of this approach. We perform
cosmological inference from GW data assuming parametric compact binary
population models. We consider two representative models for the mass spectrum,
namely a power-law model between two hard cut-offs at a minimum and maximum
mass, and a similar model combined with a Gaussian peak. Both models exhibit
characteristic scales that allow an indirect estimate of the source redshift.
In the case of the LIGO-Virgo detector network with current and future
sensitivities we perform the analysis of an extensive set of simulated data
using a hierarchical Bayesian scheme that jointly fit the source population and
cosmological parameter. We also re-analyse the LIGO-Virgo O2 data. Those
analyses all evidence the tight interplay between source population and
cosmological parameters and the influence of initial assumptions formulated on
the ones or the others. We find that: $(i)$ the upper mass cut-off and the
position of the Gaussian peak display the largest correlation with the
cosmological parameters; $(ii)$ incorrect population models may bias the Hubble
constant estimate by 40%, or incorrect value for $\Omega_{m,0}$ may lead a
significant bias on $H_0$; $(iii)$ the estimates enter the large sample regime
with asymptotic normality and $1/\sqrt{N}$ error decay from $N\sim200$ GW
events. Overall, our results suggest that the inference on source population
and cosmological parameters should be addressed \textit{jointly} and not
separately as it is in most studies so far.
