The Moon has been hit millions of times by quite large objects, most of which must have had water and/or gas bound up in their structure. None of it is left, even from the most recent impacts. So you have to think that even if it was replenished, it would be lost in a (geologically) brief period. All the small planets and satellites have lost their gases.
Gas is held to a planet by gravity, not a magnetic or electric field. The Moon's surface gravity is only 17% of Earth's, due to its small size and lower density.
The determining factors are the temperature (which determines the average speed of each gas molecule), and gravity. Basically, warm gas molecules exceed the escape velocity (at least, there is a statistical distribution of molecule energies, and some near the top of the bell curve have been bounced above escape velocity).
Most hit another molecule (i.e. short mean path) and dissipate their energy into other molecules, but some of those near the top of any atmosphere just bleed off into space. The energy distribution also depends on the molecule mass, which is why Helium is pretty rare on Earth: it is very light and hence a smack from Nitrogen, Oxygen or CO2 gives it a high speed and a good chance to escape.
Incidentally, comets are not "huge". Giotto probe measured Halleys at 15x8x8 kilometres, or about 1000 cubic km. The Moon's radius is about 1800 km, so its area is about 40 million square km. So a pure-ice Halleys would wet the whole Moon to a depth of 2.5 cm. As gas at STP, the atmosphere would be about 3 metres thick.