In the US, the laws that govern habitable residences and the related issues - such as land zoning, health regulations, sewer and water services, private and commercial building codes, etc. - are very localized at the city and county levels. So you need to check with the city and county where you want to place such a structure and determine the relevant laws.
Commercial buildings are much more heavily regulated than private residences. (And some federal laws and codes could supersede local laws.)
Many cities and counties have their zoning and building codes and requirements online, as well as permitting systems to apply for building and utility hookup permits.
It's true that some counties in the US have minimal zoning or building codes, so yes, you could move a shed to land you own in that county and build your own road, haul your water, put up solar panels, dig an outhouse, and not deal with any - or very few - regulations.
But cities and towns will be much more regulated, since zoning and building codes are used to insure public safety, and services such as water and sewer are supported by taxes and protect public health. In other words, you may not legally be able to live in a shed that does not have city sewer, water and electric service. There may also be building codes for minimum size of bedrooms, egress windows for fire, ventilation, heating systems, so even if a small house is sold as a complete residence in a package, it may not pass local building codes.
Breaking zoning, building and health codes can result in the local inspectors visiting and determining if the residence is up to code; they will not typically need a warrant or your permission to enter. They can order you to bring the residence up to code, if possible; or condemn the structure and require you to move out.