As to the OP's original question, I think there are a lot of factors at play that may contribute to making it hard to perform a true apples to apples comparison between road and mtn bike rims. Some thoughts that come to mind:
Rims designed for disc brakes don't need extra material (weight) for a brake track which wears down over time.
Disc brakes usually need more spokes than a rim brake wheel, especially on the front to transfer the braking forces from the disc through the spokes to the rim and tire. More spokes means one can go with a less strong rim, as there are shorter unsupported sections of rim between each pair of spokes and the rim is transferring less impact force through to each spoke.
Road bike wheels have got into marketing the absolutely lowest spoke count wheels possible, whereas I think that craze hasn't caught on to quite to the same degree in the mtn bike world. Having said that, I do have some very low spoke count disc mtn bike wheels. As I previously mentioned, fewer spokes often requires more material (weight) in the rim. A 32H rim may in fact have been designed to support an 18H option - they have to design for the lowest spoke count the rim may be used for.
Road bikes are generally more into aerodynamics, so more road bike rims have a deeper section than mtn bike rims. The deeper section usually requires more material (weight).
Mtn bikes have generally used disc brakes for 20 or so years, whereas road bikes are still mostly rim brakes. The result is mtn bike rims are likely all designed and intended for disc brake only applications. Since road bikes are only just starting the (attempted) transition to disc brakes, or at very least having to now support both rim and disc brakes, I suspect most road bike rims are generally still making a single rim that works for both rim or disc brake applications. In time, if rim brakes go away, they will redesign rims to cater to only disc brakes, and thus be able to remove brake track material (weight).
I can think of at least one more reason why a mtn bike rim can save weight, but it will throw us back off track with the high school math PSI/surface are side track that I suspect is still confusing some. I'm not going there again.
To make this a viable apples to apples comparison, you would need to compare a like road & mtn bike rim (same rim section), where both are designed for disc brakes only and for the same spoke counts. In other words, about the only differences would be in diameter.