And in the meanwhile, they build upon inventions and code of *many* other people. Both within and outside the FLOSS community. What mess this world would be in if every significant contributor originally involved in the software they build on (from 4.4BSD to KHTML) sought to patent their inventions? Really, they are standing on the shoulders of giants.
And the practical advantage of inventing things is being the first to the market, and this already paid off well for them, judging the popularity of the iPhone in some countries (or the near omnipresence of the iPod).