Why do the inlet cones on an SR-71 retract at higher speeds while the one on a MiG-21 extends at higher speeds?
This is only a guess, so please take this with a grain of salt.

An important characteristic of supersonic engine inlets is the total pressure loss (or also sometimes pressure recovery). The total pressure loss over a normal shockwave is a lot higher than if you would slow down the air to the same speed through several oblique shock waves.

If you want to understand why the sr-71 spike retracts I recommend you watch this video. The sr-71 had a quite complex inlet geometry to ensure that the air was slowed down over many oblique shocks.
sr-71 engine inlet 

On jet engines that don’t have such a complex inlet geometry as the sr-71, the best pressure recovery is mostly achieved by getting the primary oblique shockwave from the spike or inlet ramp, to hit the leading edge of the engine inlet, where it gets reflected as another shockwave.
 

As speed increases the primary oblique shockwave that gets formed on the spike gets shallower meaning that if you wanted to keep the shockwave of the mig-21 spike at the leading edge of the engine inlet, you need the spike to move forward as speed increases.