Why the small difference between common sizes of handlebars (31.8mm) and MTB seatposts (31.6mm)? Many handlebars have a 31.8mm clamp section, and a common MTB seatpost size is 31.6mm.
I know these are both around 1 1/4 inches. Why the 0.2mm difference though?
Frame tubing is generally standardized by external diameter to imperial dimensions in increments of 1/8 inch, which makes it a lot easier to standardize things like front derailleur clamps.  Seat tubes therefore tend to have external diameters of 1 1/8” (28.6 mm), 1 1/4” (31.8) or 1 3/8” (34.9 mm).
Handlebars are similar. Though there has been more variation historically (eg 26.0 and 26.4 mm in addition to the imperial sizes), modern bikes tend to use handlebars with imperial sizes for the clamped diameter.
The problem, however, is that the internal diameter is not standardized, because it depends on the thickness of the tubing wall, which varies quite a bit. High quality lightweight frames can have very thin-walled tubing, while lower quality frames might need thicker walled tubing to get the same strength. So two seat tubes that are both 28.6 outer diameter could have different inner diameters.
Since the seatpost diameter has to closely match the inside diameter of the seat tube, variation in inner diameter of seat tubes has resulted in a large number of different seatpost diameters. Makers of more expensive bikes have largely converged on 27.2 and 31.6, but there are still many others, especially on lower end bikes.