The higher end side is usually binned for being 'better silicon' for reaching those frequencies.
Otherwise they're generally the same hardware. Depending if they backfilled higher bins into lower models due to excess demand, or if they binned the 8120 where it should have been as it couldn't reliably operate at 8150 specifications, is a toss up for specific manufacturing runs of those CPUs.
Most hardware lines share components, such as defective cores being lasered off in the Phenom, FX or Ryzen eras, to make separation. Manufacturing quality is one of the factors that places a particular model with a CPU which can conform to those specs.