Chess.com catches them and closes them - pretty quickly for obvious ones, a little longer for sneakier ones - but they can’t stop them from coming back, not so long as they allow free members to register with just an email. Anyone who’s in more than the beginning leagues isnt cheating (yet, anyway), verified members will be even less likely to cheat. Chess.com has the strongest and most reliable cheat detection methods there is - I dunno how lichess goes about it
How to stop the cheats

You realy should be raising those points in https://www.chess.com/club/cheating-forum rather than the public forums, but I will disagree with it's a simple as these people claim it is. One point is that cheaters don't just cheat once - they do so repeatedly, and eventually give you enough of a pattern to identify and somewhat more eventually action. Chess.com is about to run a cash prize event for verified members - that will be an interesting test of both the cheaters and Chess.com's cheat detection methods.

Cheats are hard to catch, some will get away with it. Chess.com have closed accounts of players who have played against me. Chess.com try to eliminate cheats, but there's always going to be some cheats.
Apart from banning them