It think I'd start by saying that TSMC hasn't historically been in the position it currently occupies and that while TSMC has a good lead, it's not like Samsung isn't close.

A big part of TSMC's current status is probably Apple. Back in 2015, TSMC was slightly behind. The iPhone 6S was dual-sourced from TSMC and Samsung with the TSMC chips being 16nm and the Samsung ones being 14nm. Intel had launched 14nm parts a year earlier.

We don't know what agreements that Apple has made with TSMC, but it seems reasonable to think that Apple made a big multi-year commitment to TSMC potentially with up-front money that TSMC could use to get to the position it now occupies. Apple's ability to commit years in advance can really change things. TSMC could confidently invest in their future without wondering "will someone pay for it?"

Samsung has been struggling a bit with its foundry and I think part of that is that companies don't want to commit to Samsung. While Qualcomm and others would like an alternative to TSMC, they're not looking to commit to Samsung. They'd rather take a wait-and-see approach, keep their options open, and bail on Samsung at the first sign of trouble. That leaves Samsung unable to make the kind of long-term planning that TSMC can. In a way, this becomes a self-fulfilling prophecy since Samsung simply won't have the same commitment.

Apple decided that they wanted state-of-the-art foundry access and they chose TSMC to become that. That's not to say that TSMC isn't talented - Apple wouldn't choose a company that wasn't. It's simply to note that they have a very symbiotic relationship. Apple has the margins and commitment to pay for new advances so TSMC can confidently spend money knowing it has a guaranteed buyer at high rates. Once it has that advance, it can sell that capacity to other companies a year later at lower rates and make more money. This becomes self-reinforcing.

Now, many companies that have such a great self-reinforcing profit maker end up stumbling or resting on their laurels. Intel did. So it's not guaranteed that being the big fish means you'll continue being the big fish. TSMC seems reasonably committed to continuing to spend the money necessary to remain in its position and keep Apple happy.

Intel got taken over by bean-counters who preferred the short-term profits one could get by not investing as much in the future of their foundry. Even if you have the ability to spend money to remain competitive, that doesn't matter if you decide not to. For a while, this was fine for Intel. They were making good money, AMD was a mess, and x86/x64 was still king. Of course, not investing in the future will eventually bite any company.

With Samsung, there have been complaints from Samsung and AMD about their yields on the latest processes, but I think it's reasonable to think some of that is because Samsung can't confidently invest in new processes like TSMC can. That's not to say it isn't hard work for TSMC, but a lot of work is easier when you know it will pay off. "If you build it they will come," is sometimes true. TSMC hasn't needed to take that gamble since their Apple partnership started - Apple is guaranteed business. When we're talking about stuff that requires very long-term investments, having basically guaranteed business is a huge advantage.

TSMC has executed very well and I don't want to take that away from them. At the same time, they benefitted from an Intel run by bean-counters who wanted to milk profits from x86/x64 dominance rather than investing in their foundry and the fact that Apple doesn't want to use Samsung as much as possible and could make huge commitments years in advance.

I guess I might reframe the question: if you were Samsung, how would you remain competitive with TSMC? Sure, you can spend money, but will the customers come? Likewise, if you're Intel, the question is: how long will it take to regain our competitiveness? TSMC didn't build its company in a day. It was many years of top-notch execution. It will take Intel several years to get back on track - and it's not like TSMC will be resting during those years either.