The same way it works in Android phones, that enable side-loading and alternative app stores. The same way it works on Windows PCs, that let you install apps not through the MS store. The same way it works on linux, that lets you install anything not in the official repositories. There are countless examples, the Apple case is the exception (for now), not the norm, so your confusion baffles me.