I'm currently looking into building a mobile version of our website, and I've been looking at how our competitors do it. It seems that a common way to do this is check for the useragent when someone hits the main domain, and then to redirect to a mobile version of the site - m.domain.com, for example.
Quite often, our competitors are blocking search bots from indexing m.domain.com (presumably to avoid dupe content), but it's suddenly struck me that this is effectively cloaking.
Google is showing www.domain.com in the index, but when a human visitor hits that site it sees m.domain.com. Due to the fact that m.domain.com can't be indexed, that will never be displayed by the search engine, so in theory, I could have a lovely looking & well optimised page on www.domain.com, and as soon as you get redirected to the same page on m.domain.com I could serve a completely different ad-heavy page.
How does Google determine that this isn't being abused, or used for cloaking?
technically this is cloaking but it generally falls into the category of allowable cloaking. google understands that there are some situations where it makes for a better user experience and will not always ban a website that is using cloaking aka ip delivery.
here are some other tricky situation were webmasters may use cloaking: -international website redirecting a french speaking visitor from their english domain to their french domain -flash website showing an html version to help google index their content.
since this can be abused (and is abused) google is not very forthcoming about how they separate the innocent well intentioned cloaking from the spammy cloaking. google tries their best but sometimes they flag well intentioned sites and allow spam site.
I'm not sure I agree with you - I think in most cases the results served to mobile and the regular results are pretty much identical. Yes, Google use a different spider (Googlebot-mobile), but I think this is more to try and work out if you're providing a mobile version of your site, which they might give preference to within the SERPs when browsed from a mobile device. In most cases I've seen the mobile site and main site never rank separately.