The escape velocity at the surface of the moon is only 2.38 km/sec, compared with 11.19 km/sec for Earth. That's a factor of about 4.7.
Earth has trouble holding onto its hydrogen and helium, because in the upper atmosphere, it gets hit my sunlight and cosmic rays, and gets going faster than the escape velocity, and goes flying off into space. So we are slowly losing our hydrogen and helium.
Kinetic energy is proportional to velocity squared, so the Moon can only hold onto molecules with speed less than Earth can, by a factor of 4.7 squared, which is about 22. Now if an oxygen atom, with mass 16 times that of a hydrogen atom, got as much energy from photons as hydrogen atoms do in Earth's atmosphere, they would be even harder for the Moon to hold onto than hydrogen is for Earth to hold onto.