>>13612073part and parcel the cost of lumber is the kilning and treatment of the wood
2"x4" of lumber is kiln dried, the wood shrinks, its treated chemically in a variety of ways for the stated purposes
that 2x4 loses over half its weight in water when kiln dried, then usually its "sealed" or "chem treated" to either keep moisture(rot) out and prolong the lumbers life
each piece of wood is unique, the amount of moisture loss/retention is different(just look at the warped boards at a Lowe's/other chain)
it's not possible to reliable cut wood and plan for uniform shrinkage, so they measure the wood BEFORE kilning/treatments
the more expensive wood generally has less moisture, more natural decay protection, nicer smell, water repellent, etc resulting in the finished lumber being closer to the initial measurement