Hidden text is the textual content that search engines can read, but your visitors cannot read or see. It is also called Invisible or fake text.
Using such text can improve the ranking of a page, but this technique is against the guidelines of search engines and is considered a black hat SEO technique.
All major search engines treat hidden text as search spam. They can easily detect their presence and may ban your site temporarily or permanently.
Although it is black hat seo, there are some valid reasons to hide the text.
Paid Content Subscription: The websites, which offer a paid subscription, are allowed to hide content by Google. It also supports the first click free method of cloaking, which means during the initial visit from Google, you will see the content, but during the second visit to the page, the content is no longer available, and you are required to login and pay to view the content. It is intended to give a sample preview of what a paid subscription of a publisher is offering.
Elements of the Pages Designed for Mobile and Desktop: A responsive website can be changed and adjusted based on the size of a page. When a specific width limit is reached, some page elements may disappear, and some may appear. However, they are present in the source code at the same time and are temporarily hidden. It is intended for usability purposes, and Google is aware of these viewport formats. If you use it for proper mobile and desktop user experience, Google will not penalize your site.