That's because those photos are showing the black backdrop of the studio where they were taken...kidding.
The stars are not visible on the Moon, at least in photos, because the lunar surface in sunlight was so bright that the stars were washed out. No camera (nor the human eye, usually) has the dynamic range to process something very bright next to something less bright. If the aperture were open wide enough and the exposure long enough to collect enough light to image the dim source, it would collect so much light from the bright source in that time that this latter light would overpower everything else, and you would not get a comprehensible image. Try to take a picture of a candle flame with the mid-day Sun in the background.
As for human eyes, astronaut testimony may confirm stars were visible on the Moon when looking away from the surface. I do not have that information. I tend to think if a camera were pointing straight at the sky with "blinders" on to block surface light, you would see the stars just as well as in empty space.
The thing to remember on the Moon is, the lack of atmosphere means there is no refraction or scattering of light. The only light you see in any direction is the light that came from that direction. If the Sun is in your field of view, you see it. If you turn your back to it, the sky is as dark as night. Anywhere around the Sun is also as dark as night (though you may not see stars, as mentioned before). When the Sun sets, its light immediately disappears, though you would still have light from the Earth, so it may not be pitch black, but would be much darker.