Section 331 of Title 18 of the United States code provides criminal penalties for anyone who “fraudulently alters, defaces, mutilates impairs, diminishes, falsifies, scales, or lightens any of the coins coined at the Mints of the United States.” This statute means that you may be violating the law if you change the appearance of the coin and fraudulently represent it to be other than the altered coin that it is. As a matter of policy, the U.S. Mint does not promote coloring, plating or altering U.S. coinage: however, there are no sanctions against such activity absent fraudulent intent.
This statute means that you may be violating the law if you change the appearance of the coin AND fraudulently represent it to be other than the altered coin that it is. The key word is “fraudulently.”
Basically you can’t make it something it’s not, like whittling down a penny to be the shape of a dime and inserting it into coin machines.
In this case it is still a penny, an altered penny.
Think of the coin smashing souvenir machines at amusement parks and museums. If it was illegal to turn a coin into art, those machines would not exist.