If you live by that maxim and never do good, you'll never see it refuted. Truth is, people do good things all the time and are frequently rewarded for it. Sometimes people get punished for doing a good thing, but it's scarcely a certainty and our society would be a lot shittier if everybody went around assuming it was.
Just like trying to report a security vulnerability to a company in good faith, you are often better off just publishing it anonymously even if it is worse for the company.