Nearly two years after taking effect, a sweeping tax code regulating many deferred-compensation plans favored by private companies — including stock options — has confused attorneys and increased legal costs for mergers-and-acquisitions work.

Both tax and corporate attorneys add that the new law is strewn with pitfalls and complexities that hinder corporate deal making and expose executives to many costly and unnecessary penalties.