Corporations always say they want to be ethical businesses—and then the markets and Washington get involved, and everything goes to pieces. That uncomfortable truth about ethics & compliance is very much on display these days.

Let's start with Caterpillar, whose senior tax and finance executives appeared before the Senate Permanent Subcommittee on Investigations last week to defend the company's tax practices. As the Subcommittee tells the story, in the late 1990s Caterpillar and its audit firm PwC decided to restructure Caterpillar's parts business so the legal entity owning that operation was based in Switzerland—where the effective tax rate for Caterpillar would be around 5 percent. “The Swiss strategy,” as it was called, would allow Caterpillar to avoid higher U.S. tax rates even though U.S. executives still ran the parts business on a daily basis from Caterpillar headquarters in Peoria, Ill.

For Caterpillar, the arrangement was a bargain: it paid PwC $55 million in fees to help implement the program in the early 2000s, and so far has saved about $2.4 billion in taxes the company otherwise would have paid under its old structure. Caterpillar executives testifying last week defended the strategy as legal, and reflecting the company's evolution to a more globalized business. And plenty of people will agree that there is nothing unethical about striving to pay the least taxes possible.

In other words, from Caterpillar's corporate perspective—from the imperative to keep increasing profits and shareholder value, by any means legally defensible—its tax strategy passes muster. In the world of actual human beings, however, Caterpillar's moves fail the smell test several times:

PwC was Caterpillar's external auditor, as well as its tax adviser. That is legal under the Sarbanes-Oxley Act, so long as the client's audit committee pre-approves any tax consulting work, which Caterpillar's audit committee apparently did. Still, it gives the appearance of a conflict of interest.

A former tax manager for Caterpillar raised concerns about the strategy repeatedly. He was later demoted, and then filed a whistleblower retaliation lawsuit against the company that was settled for undisclosed terms in 2012.

One PwC tax partner, Thomas Quinn, warned another PwC partner in the audit practice, Steven Williams, that the firm would need to “tell a story … to retain the [tax] benefit.” Williams responded, “What the heck. We'll all be retired when this comes up on audit.”

Caterpillar, however, was not the only titan of Corporate America squirming in front of the public last week. General Motors spent two days in front of Congress, with newly named CEO Mary Barra trying to explain how the company turned a blind eye to faulty ignition switches that have led to 13 deaths over the years. Barra appeared before the House on Tuesday and then the Senate on Wednesday, offering the public a double-barreled glimpse into the bureaucratic ineptitude of large corporations. National Highway Traffic Safety Administration boss David Friedman appeared along with her at both hearings.

According to GM documents dug up by congressional investigators, the automaker knew as early as the mid-2000s that the switches in its Chevrolet Cobalt might sometimes slip into a stall and prevent passenger airbags from deploying in an accident. The defect could have been fixed for about 90 cents per switch—in a vehicle whose sticker price was $15,000—yet GM waited for years before issuing a safety recall.

Barra herself described GM's longstanding culture as “not as welcoming” of bad news as it should have been. Lawmakers, naturally, went even further. Sen. Claire McCaskill, D-Mo., said GM had a “culture of cover-up.” Others suggested GM should face criminal liability. Still others picked over the problems of “the old GM,” before its bankruptcy in 2009, with the all the adjectives that phrase brings along: slow; unresponsive; uncaring; money-hungry. The problems of the old GM, they said, seemed very much present in the new GM.

What's the connection between these two sad tales? Only that everyone seems to be talking about them (as any compliance officer knows, tax compliance and corporate culture are not subjects that often arise in casual conversation) and worse, everyone is so ready to assume the worst. I heard bartenders dismissing GM: “What they did was so wrong, but of course you can believe a big company will do that.” I heard people in line at the store scorching Caterpillar: “Could they at least be honest that they're more interested in avoiding taxes than in creating jobs?” (Fact check: Caterpillar has increased its U.S. employment by 47 percent in the last decade; overseas jobs are up nearly 100 percent.)

There is a difference between being right, and doing right. Corporate cultures allow us to slip too easily into the former, where you can obey the letter of the law while totally ignoring its spirit. Caterpillar and its allies at PwC certainly look like they've fallen into that trap. Corporate cultures can let people run away from ethics, too, and hide in the minutiae of compliance, worried about only two things: Will I get fired if I do this? Will I get fired if I don't? General Motors fell into that trap, the trap of the silos.

We have a long way to go before we truly achieve the ethical culture everyone likes to talk about. The public knows it—and most executives know it too, since business executives belong to “the public” as much as the next person. But the disconnect continues, and it requires constant vigilance to fight against it.