The Scofield Bible Commentary, by Cyrus Ingerson Scofield, , at sacred-texts.com
And it came to pass
Five phases of Jeremiah's prison experiences are recorded:
(1) He is arrested in the gate and committed to a dungeon on the false charge of treason (Jer 37:11-15).
(2) he is released from the dungeon, but restrained to the court of the prison;
(3) he is imprisoned in the miry dungeon and kept in prison court (Jer 38:1-6).
(4) he is again released from the dungeon and kept in the prison court (Jer 38:13-28) until the capture of the city;
(5) carried in chains from the city by Nebuzar-adan, captain of the guard, he is finally released at Ramah. (Jer 40:1-4).