To me, the problem with this argument is that there is, in fact, no connection between what is best for society and what is profitable. In theory, there should be, but it isn't an intrinsic thing, it's created deliberately and must be maintained.
When you have the money, you make the rules. That sums up the problem. Markets are not magical creatures, they exist within the context of social rules and norms. Selling human beings was once seen as rather profitable. Then society decided that selling human beings was wrong, even though it was profitable. You clearly understand this, we banned slavery, we didn't just ban investing in slavery-related businesses.
What I think you are missing is that there are a ton of things that are between "good for society" and something along the lines of slavery that is clearly a bad thing. The problem with these middle "bads" is that they aren't bad enough to be universally and energetically rejected.
This means that there is plenty of room for people with money to get these things made legal, or kept legal, and it is these things that often seem to be more profitable than other, more socially beneficial, activities (possibly because fewer people are morally willing and able to do them). I think of this sort of thing as "meta-competition" because it is competition among those with money to most efficiently turn their money into influence and power that can be used to allow them to make even more money.
As long as money can be converted to power, you can't assume, as you have done, that whatever is legal is socially beneficial (or at least not socially destructive).