In SEO parlance, cloaking means to present different version of web page contents on search engines to search robots and human visitors based on their browsers user agent or IP address. It is a deceptive method used to cheat search engines in order to rank well for desired keywords. Not always, but in most of the cases, cloaking is also used to trick users to visit certain websites based on their description in search engines. For example, a user searching for some product may click on a website on a search engine based on its description and title, but the final website will not be the one described in SERPs, it will be a totally different one. Therefore, these practices that are designed to manipulate search engines and deceive users by directing them to sites other than the ones they selected, and that provide content solely for the benefit of search engines should be avoided.
Cloaking is a search engine optimization technique in which the content or information presented to the user is different from that presented to search engine crawlers (i.e. spiders or bots) for better indexing. In other words, the web server is specially programmed to return different content to search engines than it returns to regular users, in an attempt to distort search engine rankings.
Cloaking is an illegal practice and is considered a Black Hat SEO and search engines may permanently ban from indexing any sites or site authors that engage in cloaking as it is implemented in order to improve search engine ranking by misleading the search engine robot into thinking the content on the page is different than it really is. It is often used as a spamdexing technique (search engine spam, search engine poisoning) to try to trick search engines into giving the relevant site a higher ranking. Some examples of cloaking include, but is not limited to, serving a page of HTML text to search engines, while showing a page of images or flash to users, and inserting text or keywords into a page only when the user-agent requesting the page is a search engine, not a human visitor.