The manufacturing and grading of families of microprocessors
Most microprocessor manufacturing (along with countless other devices) undergo the process of binning: all similar products are made at once, and depending on their performance, are placed into "bins" (groups) of similarly performing products, and then packaged and sold accordingly.

In the case of Intel processors (AMD is similar), generally processors within the same line are manufactured together, and are binned according to their stable clock frequency. You can tell when a processor is part of the same "line," by looking at the core codename, or if that is not specific enough, the features of the core (as mentioned by embedded.kyle, the i5 doesn't have hyperthreading, but the i7 does, even though both in question are "Sandy Bridge").

Sometimes a higher-end processor that fails can still be sold as another. An example I know first-hand is that the M0 steppings of the old Northwood-core Pentium 4's (130nm process) were actually failed Gallatin-core processors (which was the core for the P4 "Extreme Edition"). Similarly, a lot of people had/have luck unlocking extra cores, caches and shader units on various CPUs and GPUs. For example, it is quite common to be able to buy a mid-high range video card (take for example, the AMD Radeon 6850) and flash it with the BIOS of the higher-level card (the Radeon 6870, in this case) and gain the extra things that card has (some extra shader cores). This also has to do with binning during the manufacturing process.

This sort of thing drives overclockers to take good note of the stepping, place of origin, and batch number of their processors. When word gets out that certain batches of processors are overclocking better than their not-as-potent brethren (same CPU, mind you, just made at a different time or place), they become more in demand.

If you're interested more, definitely search "CPU Binning," or read up at some forums. I'm a member at www.overclockers.com, and the forum there is quite welcoming and has a wealth of past and current knowledge (along with an abundance of fantastic members).