Context: The determination of the stellar initial mass function (IMF) of massive galaxies is one of the open problems in cosmology. Strong gravitational lensing is one of the few methods that allow us to constrain the IMF outside of the Local Group. Aims: The goal of this study is to statistically constrain the distribution in the IMF mismatch parameter, defined as the ratio between the true stellar mass of a galaxy and that inferred assuming a reference IMF, of massive galaxies from the BOSS CMASS sample. Methods: We take 23 strong lenses drawn from the CMASS sample, measure their Einstein radii and stellar masses using multi-band photometry from the Hyper Suprime-Cam survey, then fit a model distribution for the IMF mismatch parameter and dark matter halo mass to the whole sample. We use a prior on halo mass from weak lensing measurements and account for strong lensing selection effects in our model. Results: Assuming an NFW density profile for the dark matter distribution, we infer a value $mu_{mathrm{IMF}} = -0.04pm0.11$ for the average base-10 logarithm of the IMF mismatch parameter, defined with respect to a Chabrier IMF. A Salpeter IMF is in tension with our measurements. Conclusions: Our results are consistent with a scenario in which the region of massive galaxies where the IMF normalization is significantly heavier than that of the Milky Way is much smaller than the scales $5sim10$~kpc probed by the Einstein radius of the lenses in our sample, as recent spatially resolved studies of the IMF in massive galaxies suggest. The MCMC chains describing the posterior probability distribution of the model are available online, together with the code used to obtain them.