2x4 lumber is cut into rough boards in the milling process which are actually 2 by 4. These are dried (at which point they shrink) and planed (the wood will warp a bit during the drying process, jointing and planing will help correct this) so the resulting boards are smaller than their original 2x4 size.
Some more surprising detail in reality :)