"My mamma said, 'If you don't have something nice to say then say nothing at all'" - unknown.
Your Mamma was probably defending the powers-that-be, knowingly or not, by repeating this mindless phrase.
It means, when the cops brutalize your neighbor, stay silent. It's not nice to complain that the cops and your legally elected officials are "not nice". It's really not nice to say that. Please STFU! Obey the laws, even they are unfair, or support slavery, or segregation. OBEY!