Scattering of polaritons by a two-dimensional electron gas in a semiconductor microcavity