This makes me wonder, why don't they produce semiconductors themselves instead of selling the machines to produce them?
Apart from the different field of expertise at play (think manufacturing cooking equipment vs running a full-scale canteen), there's also environmental concerns. Looks like ASML has outsourced much of the production of key components to 3rd-party countries.
Electronics manufacturing has a considerable environmental impact (see articles about chemical soil/water pollution in china) and global north countries are happy to have others exploit their population and damage their environment in their place. This is similar to how the "recycling" industry operates.