Moisture control is a whole other matter and a bit more difficult to explain.
For those who already understand it or who just don't care about the details, please skip this post.
At its core, moisture control is a relative humidity issue. Warm air holds more water than cold air. Relative humidity is a term that means
the amount of water that is actually in the air VS the maximum amount of water that
could be held in the air. Setting precise amounts and temperatures aside for just a moment, if a room at a given temperature is capable of holding a bucket of water, but is actually only holding a quarter of a bucket of water, then the relative humidity is 25%. Hot air can hold a crap load of water. Cold air can't hold much at all. The numbers are not linear so one cannot simply write a an easy formula to calculate them. HVAC people use what is called a psychometric chart to look up the actual numbers.
For those who are interested, Here is a photo of such a chart. The top left curve is the dew point line. The bottom line (x axis) is dry air at 0% humidity.
Not really a very easy graph to use. But feel free to print it out and play with it.......
Back to our room with a quarter bucket of water in it.
If you start cooling the room, without adding or removing any water, the relative humidity starts climbing because the maximum amount of water that the colder air can hold is diving. At some point in that dive, 100% relative humidity is reached. This point for that air is called "the dew point" because that is the temperature, for that air, with that amount of water in it, starts to condense and form droplets of water on the surfaces in the room. If the temp drops fast enough, fog will form. Even faster and it will start raining or snowing.
The problem with an insulated wall is that insulation usually entraps air to achieve a good insulating value. (Air that is trapped and not circulating is an excellent insulator). If that air contains any water vapour in it (as it usually does), the temperature drop will cause the water to condense inside the insulation and on the surface. In addition to causing mold, water is a poor insulator. So the R value deteriorates with water content. All bad stuff.
This is the reason for a moisture barrier. Warm inside air usually (but not always) holds more water in it than cold outside air - not just because it can, but also because we add more water to it from our own, sweat, boiling water, burning fuel, drying things, etc. We don't want that water to get inside the insulation or to reach the outside walls where it could condense due to the lower temperatures, so we install a plastic or metal vapour barrier on the inside wall to stop air from carrying that moisture into the wall where it could condense if the air was cooled down to its dew point.
With the exception of humidity controlled wall spaces, you only want the moisture barrier on the inside wall. Basically, you want the insulation to be able to "breathe" so that it always has the same moisture content as the cold outside air.
Closed cell foam insulation is ok because it works in both directions - the gas trapped inside it is dry and it is also a natural vapour barrier.
The obvious issue that arises with an inside vapour barrier hapoens when the inside air is cooler than the outside air. That's why air conditioning and/or dehumidifying is so important. The both keep the dew point below the actual temperature. It isn't practical to refrigerate or dehumidify the outside air. Mother nature does that for us - or not.
As with insulation, I provide this basic explanation only for the benefit of those who are interested.