In the former case, drafting error on the part of Congress, in the latter, procedural errors.
Usually when people are pissed off at the tax code, though, it's because capital gains are taxed at a lower rate, which is not only intentional, but also common knowledge that wouldn't require the specialists that are usually invoked: "they have armies of accountants who know the loopholes to ensure they don't pay tax".
I know of a few tricky things in the Code. For example, the US taxes the donor of a gift, not the recipient, because inter vivos gifts were being used to avoid the estate tax. In keeping with taxing estates, we created the Gift Tax. However, recipients don't pay income tax. In most countries, it's the other way around. Therefore, if you are a US tax person (resident or citizen, roughly, though that's not entirely correct) and your parents are non-resident aliens, they can give you, say, a gift of $10 million. They don't pay tax because in their country they're not the paying party, and you don't pay tax (assuming you're not still a citizen of that country and subject to tax, and because most countries tax on where you're located, you're probably not subject to tax there if you're living here). THAT'S sort of a loophole.
ἡ δὲ κἀκ τριῶν τρυπημάτων ἐργαζομένη ἐνεκάλει τῇ φύσει, δυσφορουμένη, ὅτι δὴ μὴ καὶ τοὺς τιτθοὺς αὐτῇ εὐρύτερον ἢ νῦν εἰσι τρυπώη, ὅπως καὶ ἄλλην ἐνταῦθα μίξιν ἐπιτεχνᾶσθαι δυνατὴ εἴη. – Procopius
Ummaka qinnassa nīk!
*MySmiley*