MA law doesn't allow merchants to add in the 3% credit card fee. It does, however allow discounts for cash. Which is how stores advertise it. That's probably the smarter way to advertise the fee, but many merchants just follow the crowd.
There has ALWAYS been a 3% fee for using a credit card. It's just that the law was recently changed to allow merchants to charge it to the customer, rather than absorbing it themselves. In the past, whether you used a credit card or paid cash, the fee was baked into the cost of the product you were purchasing. As someone who pays cash when I can, I'm glad to see it separated out so that I only have to pay it if I'm actually using a credit card!