Some companies do this and pay the candidate for their time, regardless of outcome. I don't think there's much to comment there. Some don't pay the candidate. In that case, it's just a predatory practice to take advantage of the tough job market.
That tradeoff makes enough economic sense to me personally, but to each their own.
I do agree that companies flush with profit should be able to offer a stipend though, and unwillingness to do so is a signal I use to evaluate them.
It doesn't change the fact that the real work could be an hour's exercise or longer remunerated work. This isn't an either/or scenario like you put it. Plus, for a fact, companies will happily have you doing both the leetcode and the take-home test.
it seems like such an obvious target for the likes of north korean saboteurs.
Interships already exist as "doing work as an interview"