If medicaid didn't pay the whole thing (part of it probably wasn't eligable?) then you owe the balance.
That isn't illegal, it's how insurance works and medicaid is like an insurance.
It is strange that they waited 4 years though. I would call and ask what it is because they should NOT be waiting that long to bill you. Unfortunately, there are rules on how long they can take to bill insurance, and it is written right into policies and the doctor's forms that you sign that if they bill late, you are still liable for it. Once I had a pediatrician "forget" to bill for my daughter's visit until after 90 days. Well, insurance only has to accept it up to 90 days after the date of service, so now I was liable for the entire visit. I had paid my copay on the date I was there. Technically, they were legally allowed to come after me for the balance. I acted like I didn't know that, kept complaining and they dropped it.