I don't think people should lie to each other. That's quite rude – yet living in a world with no lies would leave us ill-prepared for mistakes or exceptional con artists. Even pretending people always tell the truth does a tremendous disservice to people too young to notice. When dealing with strangers, there is essentially no downside to skepticism, and there can be tremendous costs to giving out trust when it hasn't been earned.
Of course, to say lying is wrong doesn't totally answer the question about whether you should do it. Killing people is wrong, and yet some wars are justified. We should think about the balance of concerns, as well as our ethical injunctions against egregious behavior.
Sokal-style hoaxes are false research papers sent for publication, attempting to test the limits of the most absurd lies they can get through the academic process. There are a couple lies involved in creating hoaxes like these, so lets take them separately.
Lying to research subjects is actually pretty standard. You say you're studying visual perception, but you're actually studying conformity. You say you're studying some test results, but use it as a window into how people cheat on tests. This is absolutely required in psychology – there are few studies that can give useful results when there is perfect disclosure. So we must not have an ethical injunction about misleading people in studies. We sort of have an injunction against studying people without their consent, but truthfully, post-hoc data analysis is so common that we can't possibly take that kind of injunction seriously outside of e.g. the use of medical data.
The structure of the hoax has the journals lie on behalf of the hoaxers as well, lending their name to the lie. I'm not too concerned with this, despite this being a pretty reasonable thing to have an ethical injunction against. The whole point is to establish that a journal will publish outrageously stupid lies. This behavior degrades trust in institutions, but only when it is completely deserved. People shouldn't trust those publications. The hoax papers are not the only ones that are flawed.
Stated in that way, the objection that the hoax is somewhat pointless (which one of the editors of a hoaxed journal attempted) is obviously false. The probability a paper is good, conditional on it being published by them, should go down. There's a proper Bayesian update going on here, and a useful one for academics. Any citations of these journals could reasonably be left out – unless you want to cite the existence of the paper, there's not much you should imply about truth gleaned from it.
At the end of the day, we need hoaxes like this. Not because they take people who deserve it down a few pegs. But because we have far too much systemic uncertainty. When actual wrong-doing or negligence occurs, it can go unnoticed indefinitely. Having major psychology results fail to replicate is just the tip of the iceberg – lesser known results will be less reliable, and actual malicious influence would use the tools of the academy to spread lies. Ignorance is better than building a tool for malicious or self-interested propaganda.
Or, we could just pretend it's okay that outrageous lies needed to be disclosed by third parties before journals retract them. This is a war on academia – a special moment, in confronting bad behavior, where standard ethical rules must be put aside because there are higher goals. Thank goodness nobody gets anything more than a bruised ego.