Search engines try to discover cloakers by using a number of techniques:
By visiting using an IP address which is not registered to their company.
By visiting using a non-spider user agent
By comparing caches from different sources that they own; i.e., from their main spider and from their page accelerator
By comparing caches from different sources that they don’t own; i.e., from their main spider and from some other company’s cache
By using an algorithmic process to identify likely candidates and using human editors to verify.
Cloaking with intent to deceive users is bad. Other than that, there are many many sites that cloak in various ways: Geo-targeting, server-side page adaptation to client capabilities (e.g. PDAs versus desktops), content negotiation, ephemeral page content removed for SE-cached pages, etc.