The net value of the two villages increases because value is in the eye of the beholder. If commodity S is more valuable to village A than to village B, and commodity T is more valuable to B than A, then, when they trade, both villages gained something of more value to them and the relative wealth of both villages increased.
Value comes from the valuator.
This is why--one of the reasons, anyway--Marxism was doomed. Value doesn't come from labor at all. Only cost comes from labor. For example, if I go stand in the middle of the road and labor all day pointing at the sky, I've worked hard but created no value, because no one else values my sky-pointing. Similarly, if I build two houses and put exactly the same amount of labor into both of them, but one is on a mountain with a beautiful view of the city, and the other is next to the city dump, the first will be far more valuable because people would value the location of the first, "envaluating" the house.