It isn't legal. The SCOTUS has ruled that indefinite solitary confinement violates the due process clause of the 14th Amendment.
There really ought to be a judicial process for determining which prison you ought to be serving your sentence in. If you become enemy to the feds you get a life of absolute hell thanks to some guy high up placing you there you out of vendetta.