He was in protective custody. After he cooperated, they morphed his 'custody' into time served, but he was living comfortably and he was being hidden from any possible assassination attempt, which was a real worry at the time:
JOHN DEAN: Technically, let me correct you. I really never did go to prison. I was 127 days in the custody of the U.S. Marshalls because I was in the Witness Protection Program. The government was very concerned about keeping me alive. I really have not let that get corrected over the years. It's out there on the web. It's on different sites.
AMY GOODMAN: Weren't you in prison?
JOHN DEAN: I was not in prison.
AMY GOODMAN: Weren't you in jail?
JOHN DEAN: I was not in jail.
AMY GOODMAN: In detention?
JOHN DEAN: I was in custody and would stay in a safe house at night. I spent most of that time in the U.S. -- excuse me, in the Watergate Special Prosecutor’s office. I was driven to the office every day from the safe house. I was actually during the time that the trials were going on, I was in the courthouse in the prosecutor's office.
AMY GOODMAN: Wasn't it a sentence?
JOHN DEAN: It was part of a sentence -- well, yes. It became the sentence, the judge after -- had sentenced me just before the trial started, and after 127 days later, said time served.
AMY GOODMAN: And that time you had served in the prosecutor's office?
JOHN DEAN: More or less.
AMY GOODMAN: You never served a night in any kind of detention facility?
JOHN DEAN: Well in a safe house, yes.
AMY GOODMAN: With other people?
JOHN DEAN: There were other government witnesses in that facility, yes. My next door neighbor happened to be former mafia hit man who once told me, you know, John, I always liked Richard Nixon until I realized he wasn't a very good criminal.
AMY GOODMAN: Is that place still a house of detention?
JOHN DEAN: I don't know. They don't -- they don't advertise it. It's part of the witness protection program. Well – Anyway, a technical point that I just thought I would clear up. http://www.democracynow.org/article.pl?sid=04/04/06/1354218