Richard Lovelace was a royalist officer during the first civil war in England from 1642 to 1646. Having been captured,m he was sent to Coventry, literally. Royalist officers were imprisoned there, and that is the origin of the expression. The poem below, "To Althea, from Prison," will be recognizable to many for a pair of lines at the end of it:
I.
When love with unconfinèd wings
Hovers within my gates;
And my divine Althea brings
To whisper at the grates;
When I lye tangled in her haire,
And fetter'd to her eye,
The birds, that wanton in the aire,
Know no such libertie.
II.
When flowing cups run swiftly round
With no allaying Thames,
Our carelesse heads with roses bound,
Our hearts with loyal flames;
When thirsty griefe in wine we steepe,
When healths and draughts go free,
Fishes, that tipple in the deepe,
Know no such libertie.
III.
When (like committed linnets) I
With shriller throat shall sing
The sweetnes, mercy, majesty,
And glories of my King.
When I shall voyce aloud, how good
He is, how great should be,
Inlargèd winds, that curle the flood,
Know no such libertie.
IV.
Stone walls doe not a prison make,
Nor iron bars a cage;
Mindes innocent and quiet take
That for an hermitage;
If I have freedome in my love,
And in my soule am free,
Angels alone that soar above
Enjoy such libertie.