Its all about the architecture and bonus features.
i7's have hyper threading which turns their 4 physical cores into 8 logical cores, the 4 logical cores created by this arent quite as fast but still provide about a 40% boost to massively multithreaded tasks, they also have turbo boost which will turn their clocks up by a few hundred MHz when it needs to, and they have more instructions per clock.
Just like GPUs, CPUs have made it to a stage where looking at their specs you have no idea what their overall performance will be, the numbers on the box are fairly meaningless these days.