Counterstamps were ways for established banks and businesses to verify the weight of currency. By stamping it, they were essentially "guaranteeing" the weight as per their measurement/scale. Some individuals are also known to have counterstamped coins, probably for the same reason. Seems to me that counterstamping has always existed (biting silver & gold coins to ensure purity was one form - if the bite didn't leave a mark, it wasn't as pure as it should have been) but grew increasingly popular in the latter third of the 1800s, when the silver content of US coins was reduced.
You can also find counterstamps on copper coins too, on occasion. I'm pretty sure this was just a verification of authenticity rather than metal content. A penny could buy a good bit back in the day, so counterfeits weren't totally unheard of. These days you can find any denomination of change in the gutter so it's not worth the time or effort to fake them.