The devices generally do not connect to Home Assistant as a server, the Home Assistant connects to them as a client. The devices are generally oblivious about Home Assistant and it's nature.
I have z-wave thermostats. They have no idea what internet even is. They presumed they would be sold into some partner's hub ecosystem, but as a consequence Home Assistant can talk to it direct.
I attached an open firmware based controller to my garage door opener. The garage door opener doesn't know what networking is, and even the open source controller is oblivious to home assistant, just providing a general, locally accessible HTTP api. Home assistant connects to it.
If you are careful, you can generally find networkable components that do not expect to connect to any server, but can be connected to. Matter over Thread is *generally* a safe bet the device in question is friendly to local usage.
However, a lot of devices have firmware hard coded to connect only to their suppliers internet presence. Without an account you can't control them. Sometimes they start charging a subscription. Sometimes they discontinue allowing a device to connect and operate, suggesting you buy the new model after a couple of years. Meanwhile their 'cloud' doesn't add anything that you couldn't have added yourself. Get a free domain and a let's encrypt certificate and you can connect to your house from anywhere, if you want. Or keep it closed off to anything outside your house. Or 'shadow' select stuff into remote access while keeping some things local.