They both means restriction of a criminal in a place but what is the main difference?
Jails are run by the county or city, and are for people being incarcerated for a short period of time, while prisons are run by the state or federal governments, for people with longer sentences. Prisons are less comfortable.
Jail is a spot inside the prison complex, for example: the prisoners sleep on the jail, and at the morning play basketball with your prison's colleagues
Have you watched Orange is the new black? I think I saw one episode where they tell the difference: Jail is where you go and they hold you for some hours. Prisons are for long time servings.
Some of the above answers have most of the correct answer. Jail is typically for periods of incarceration of less than a year OR where individuals are held pending trials. Prisons are for those serving sentences longer than 1 year.