In michigan,i was billed $8040.00 for a 4 mth. stay in jail , which was not court ordered; isn't that illegal?:
Something is missing from the story.  I took a look at the statute and it says that the County can seek reimbursement "for any expenses incurred by the county in relation to a charge for which a person was sentenced to a county jail" as more fully described in the statute.  The statute is clear that a conviction is required.  

If the charges were dismissed or you were found not guilty, then the County cannot seek reimbursement.  If you were found guilty and sentenced to County jail, then you must pay.  If you reached a plea agreement and were sentenced to "time served", then the County can seek reimbursement.

If you sat in jail for 4 months, you were either convicted or you couldn't make bail while you were waiting for trial.    If you were convicted, even with a plea bargain, you probably owe the money.