Works both ways. There are publishing functions and development functions.
A "studio" does development. It can be independent or owned by a bigger company.
A "publisher" focuses on handling distribution / sales & marketing functions. It can publish games from studios it owns ("first party") or from external studios it has business contracts with ("third party").
There are companies that do various mixes of these functions, but the biggest tend to do them all.