So that’s not it. Naively so.
• Tesla gave away its EV patents.
• Pixar and DreamWorks have both open-sourced some of their tools, including tools used to make some of their best works. For example DreamWorks' MoonRay renderer has been used on everything they have done since "How to Train Your Dragon: The Hidden World", including "Puss in Boots: The Last Wish" and "The Wild Robot", and will be used on their upcoming films.
• Facebook open-sourced React.
• Google open-sourced Chromium.
A better answer is meta releases them for some combination of they see it benefitting the business and/or a desire to provide broad benefits to everyone. They certainly expend tremendous resources to create these models. No other company has provided this much value to such a large base of users in this space.
FB sells ad space on several apps. those apps needs people on them in order for the ad space to be worth anything. people, in turn, need content to attract them to the apps. so it's simple: enable people/companies/whomever to generate tons of content for cheap and consequently share it on the apps. that's it.