The two stacks are of equal weight, since they both have the same total amount of mass above them.
The same principle applies to the atmosphere. Imagine two regions of the atmosphere, one with dense air on top of light air, and one with light air on top of dense air. The pressure at the ground at these two places might very well be equal, if there's the same total amount of air above them. Well, the atmosphere is like that: Near the ground, the air is warmer and less dense near the equator (red) than near the pole (pink), while at a height of 15 to 20 km, the air is actually warmer and less dense near the pole (purple) than near the equator (blue). The surface pressures at the equator and pole are almost identical.
Note: in the figure below, the terms "denser" and "not so dense" are in relation to other air AT THE SAME LEVEL. Both lower boxes have denser air than both upper boxes.
If you think about it, it should be obvious that the lower you are in the atmosphere, the more air you have above you, and therefore the higher the air pressure. Indeed, the change in pressure with height is so regular that meteorologists use pressure as a vertical coordinate instead of height. So instead of seeing weather maps at, say, 1.5 km, you would see a map at 850 mb, which is approximately 1.5 km above sea level.
To convert from pressure to height, just remember two rules: