This is the received wisdom, but not sure it happens. It might be something that happens at high levels, but it's uncommon for most people to even get a rejection letter or email in the first place, this notion of companies badmouthing you then them telling you that's why you were not hired is just... weird.
Someone would have to call/email your former company, they'd have to put something in writing (or recording) that specifically was negative about you, the company you are applying to would then need to keep a record of that, and then tell you why you weren't hired was because of that negative information.
Has that ever happened to anyone?
It feels to me like the 'lawsuits!' excuse is mostly a smokescreen to cover people being lazy, rude or incompetent at their job of actually managing a hiring process.