The origin of the enhanced metallicity of satellite galaxies