Taxes are, let’s face it, boring. Of course, no one likes paying taxes, but even less people like reading or learning about taxes. The tax code, with its extreme complexities, dry language, and constant changes, is the kind of thing that makes people joke about how accounting is a boring field (which, for the record, is not at all true). But learning the details of the tax code is one of the ways Wall Street gets, and stays, rich.

When people think of bankers and taxes, the first thing they think of is tax avoidance and, well, probably tax evasion, too. Banks do find ways to help their clients minimize taxes and, like all companies, look for ways to minimize their own tax burden. That is entirely true, and it’s also true that there is a tiny minority who help people do illegal things. But that’s just the tip of the iceberg when it comes to getting rich off taxes.

For investors, one problem with making money in the market is the steep taxes. Short term capital gains taxes come in at 37% for the highest income taxpayers, which eats into profits quickly. For activist investors, this is a bigger problem. Let’s say you earn 11% in a year when the S&P 500 is up 10% in a year. Well, the taxes on your profits will bring your net return to less than 7%, or three whole percentage points below the index!

This is one reason why short-term trading strategies need to earn a very, very high return to be worth the effort. And it’s another reason why equity funds focus on tax advantaged portfolio rotation.

I know that sounds like jargon, but the idea is simple. You have a fund with hundreds of different assets and you want to maximize profits. One way to do this is to take advantage of the tax code—things like offsetting capital losses to minimize capital gains or finding correlated assets to (legally!) avoid wash sale rules. And if you’re good at having an outsized return from faster trading as well as a system to stop the taxman from eating into your profits, you also have a fund that you can charge high management fees for—and many investors will happily pay.

For fundamental investors, the tax code is also an opportunity to discover frauds, inaccuracies, misstatements, and so on. And, of course, analyzing changes in corporate structure that will impact their tax burden can give analysts a huge edge when recommending individual holdings to portfolio managers or clients. Knowing how a corporation is going to be taxed in the future can help you uncover earnings surprises that the market might not be thinking about—especially when it comes to companies that are undergoing a lot of structural change.

Within a fund one can minimize tax burdens through various methods, but wealth managers who are looking at a holistic view of an individual’s financial life can find other ways of boosting returns outside of the fund structure. Differently structured structures of tax-advantaged and non-advantaged accounts will give wealth managers an edge and make their clients love them. Combine that with good and clear advice to clients on how these strategies save them money, and you suddenly have a recipe for a large and loyal client following.

These aren’t the only ways the tax system can be leveraged to boost profits and make a career in finance—we haven’t even got into the nitty gritty of forensic accounting or financial due diligence! But needless to say, while taxes can be boring, understanding taxes can also mean making a lot of money—and that’s not boring at all.