Is it wrong to get sentenced to prison for throwing gum on the street?

A question reminding us, that laws are invented to serve the common good by setting rules and creating punishment, for safety as well as meeting a sense of justice. But also reminding us, that it’s not that easy formulating a logical and practical connection between crime, law and punishment. 

Where is the border between a petty crime or a serious felony? And what is the consequence of a punishment that’s too heavy?