Basically, they do this by designing incentives. Perhaps they are trying to add value by making their products as good and as easy to use as possible. They also seem to allow some level of friction to exist by not using their product, discouraging them from exploring other options, and exiting the ecosystem. One of the best examples of this. Many people fear having to navigate another company’s interface and “learn” how to migrate their images, contacts, messages, etc. The reality is that as humans we are (most of the time) lazy animals and the majority of people will take the path of least resistance. So, for incentives, they stay inside Apple’s walls. Over time, walls begin to look like cages.
Just as these software giants have created walled gardens to try and keep us there, governments and central banks also use political fiat currency systems. Central banks issue money and governments insist on accepting this money. A fiat currency system is a classic example of a walled garden. The difference is that there are armed soldiers outside the flat yard walls of the government and its central bank.