From my understanding (which is admittedly 2nd hand so may be faulty), medicare grants you, and thus the hospital you're training at, funding equal to the amount of years it will take you to finish the specialty you first matched into. Thus if you started IM, you get 3 years of funding and if you switched into rads after internship, you still have two years remaining though you have four years of residency remaining. The hospital thus has to pay your salary itself for two years and looses money on the "bonus" it gets for training residents (overall a hospital gets around $100k from medicare per year for each resident it trains).
You thus have to convince programs that you are worth training in spite of that, which may sound impossible but still happens all the time from my understanding. To be honest, the 3-4 people who've switched that I know personally have all been surgeons, but some switched after their 2nd or 3rd year so they had burned through a few years of funding already as well.