To deprive any person of citizenship for any reason, including violation of the law, is to create a dangerous precedent and enter a legal and constitutional minefield, particularly when, as would generally happen, the person in question is rendered stateless.
It would, in any case, clearly be very draconian to remove citizenship from everyone who is incarcerated for any offense. However, the range of possible offenses is so wide and the gradations between them, over millions of cases, so subtle that it becomes impossible to draw a bright line between those prisoners whom one might describe as “deserving” of citizenship and the rest. Thus, as a purely practical matter, it is easiest to apply the general rule that citizenship is never lost through imprisonment.
Even if such a bright line could be drawn, citizenship is not based on virtue. The United States of America turns down vast numbers of applications for citizenship from people who are in no way criminal. For those who meet the requirements for citizenship, it is not a gift from the government or a reward for good behavior. It is a right. Obviously, a person who is convicted of a crime and incarcerated loses some rights, most obviously the right to liberty. However, there is a clear reason why this right must temporarily be denied, since it is an integral part of the rehabilitation and punishment. However, it is not in any way necessary for the purposes of rehabilitation or even of punishment to take away citizenship. To allow a government to do this to millions of people without any obvious benefit would be drastically and dangerously to increase the powers of government for no good reason.