Masks tend to fog up due to some form of contaminant on the glass. You are told when you buy a new mask to give it a toothpaste treatment, or “burn it gently with a lighter.” These theories have dubious origins and the reality is that the glass is dirty: silicones from manufacture, sunscreen, and natural body fluids all make the glass oily.

The trick is to wash the mask with warm soapy water. End of story, a clean piece of glass will not fog up. Baby shampoo is often recommended due to the fact that if you leave a residue in the mask it wont burn your eyes, but after years and years of experimenting and testing all the different suggestions I can assure you warm soapy water works like a charm.
I wash everything with Bio-Classic (an enzyme-based washing powder that is great for cleaning off body fluids) and this includes all my masks. I rinse them well after washing and store them in a plastic container.
I have found that this does not work with some masks, particularly the one-piece masks with the silicone moulded onto the glass. These seem to have a more difficult contaminant film to remove from the glass. Also I find a clean piece of glass will fog up. The inside of the glass port on a camera housing will fog up if the air inside is humid when it is sealed, and this glass is usually quite clean. It is possible that your lenses are actually coated with a residue of detergent from the washing which acts as a defogger during the next use.
Cheers,
Peter