We present the results of a study of weak gravitational lensing by galaxies using imaging data that were obtained as part of the second Red Sequence Cluster Survey (RCS2). In order to compare to the baryonic properties of the lenses we focus here on the ∼300 square degrees that overlap with the data release 7 (DR7) of the Sloan Digital Sky Survey (SDSS). The depth and image quality of the RCS2 enables us to significantly improve upon earlier work for luminous galaxies at z ≥ 0.3. To model the lensing signal we employ a halo model which accounts for the clustering of the lenses and distinguishes between satellite and central galaxies. Comparison with dynamical masses from the SDSS shows a good correlation with the lensing mass for early-type galaxies. The correlation is less clear for late-type galaxies, possibly due to rotation. For low luminosity (stellar mass) early-type galaxies we find a satellite fraction of ∼40% which rapidly decreases to <10% with increasing luminosity (stellar mass). The satellite fraction of the late-types has a value in the range 0-15%, independent of luminosity or stellar mass. At high masses the satellite fraction is not well constrained, which we partly attribute to the modelling assumptions. To infer virial masses we apply simple models based on an independent satellite kinematics analysis to account for intrinsic scatter in the scaling relations. We find that early-types in the range 10 10 < L r < 10 11.5 L have virial masses that are about five times higher than those of late-type galaxies and that the mass scales as M 200 ∝ L 2.34 +0.09 −0.16 . For an early-type galaxy with a fiducal luminosity of 10 11 L r, , we obtain a mass M 200 = (1.93 +0.13 −0.14 ) × 10 13 h −1 M . We also measure the virial mass-to-light ratio, and find for L 200 < 10 11 L a value of M 200 /L 200 = 42 ± 10 for early-types, which increases for higher luminosities to values that are consistent with those observed for groups and clusters of galaxies. For late-type galaxies we find a lower value of M 200 /L 200 = 17 ± 9. Our measurements also show that early-and late-type galaxies have comparable halo masses for stellar masses M * < 10 11 M , whereas the virial masses of early-type galaxies are higher for higher stellar masses. To compare the efficiency with which baryons have been converted into stars, we determine the total stellar mass within r 200 . Our results for early-type galaxies suggest a variation in efficiency with a minimum of ∼10% for a stellar mass M * ,200 = 10 12 M . The results for the late-type galaxies are not well constrained, but do suggest a larger value.