Each program has two "caps" -- a Medicare / funding cap and an RRC training cap.
The RRC accredits programs, assesses them, and caps them at a certain number of residents based upon educational resources. Each specialty has a somewhat different way of doing this, but they look at patients + teachers + space + educational success in the past + following the rules + duty hours + etc. This cap is inviolate -- you are not allowed to train more residents than your RRC allows (exceptions are sometimes made in a crisis, like with Katrina when programs were allowed to increase their RRC caps slightly to absorb displaced residents, etc). At any time, a program can request an increase in their RRC cap -- usually they would get site visited and then the RRC would decide whether to increase the cap or not.
Separate from this is funding. Funding comes from Medicare, and is regulated at the level of the institution (not the program). Hence, Man's Best Hospital (MBH) might have 3 residency programs -- Medicine, Surgery, and Peds. They could have a Medicare cap (i.e. maximum number of funded spots) of 80. They could distribute those 80 slots amongst all three of their programs in whatever proportion they want. The number of slots available to each institution was fixed by the BBA of 1999 -- prior to that you could simply bill medicare for as many residents as you wanted.
If the number of RRC approved positions is larger than the number of funded slots, and if those positions are filled, then someone (either the institution as a whole, or the program) needs to pay for the overage. There is nothing illegal nor immoral about this, it happens all the time.
In reality, each program has a certain number of slots funded by the institution. I don't have to go to GME begging each year, I know they will fund X categorical, Y primary care, and Z prelim slots each year. If I want more than this, then I need to beg. Some years a program will use less than their assigned slots -- and that would allow some other program to go over.
Now, to get to the situation of the OP. First, if they told you they were signing you into a categorical spot and now telling you it's just a prelim / 1 year spot, you've been had. Because the position was outside of the match, there isn't much you can do. You can see if your contract specifically said it was expected to be renewed. Still, this is an uphill battle that you're likely to lose -- employers can lay off workers due to financial constraints.
GME decides if a specific program gets "additional funding" for a slot -- remembering that the total pot of money is fixed, so if you get funding, someone else doesn't (or some other spot goes unfilled).
Prelims staying in medicine is not exactly competition for you (unless you're trying to stay in medicine). If the IM PD has funding for 10 slots per year, and matches 6 categorical residents and 10 prelims and then picks 4 prelims to continue onwards, that's totally fine and reasonable budgeting of his/her slots. If the IM program is keeping extra people beyond their usual slots, then that's something you could try to compete against.
Just be aware that if your spot is paid for with outside funding -- a grant, or industry money, etc -- and that's now dried up, and now your dept goes to GME looking for money --> GME tends to hate this. I mean, really, if you're going to be a good PD you should have all years of funding for any resident in the bank before taking them on.