Market Share != Profit Share.... Hell Market Share doesn't even imply Profit Share. The two things are completely unrelated. Sometimes (maybe even most of the time) there is a correlation, but so far that has not held true in this particular market. Apple has never had more than 20% of the "PC" market and yet they're the most profitable (and in my mind, most successful) "PC" Manufacturer on the market (and I'm using "PC" in the Generic and not the Microsoft-specific form). They've proven you don't need to have 80%+ Market Share to be a success or a hit or wildly profitable. Android has proven the opposite in that having 80% market share doesn't mean it's a gigantic party for all involved.
Samsung makes money hand-over-fist by almost literally copying Apple. They focused on a handful of models that they update annually (the Galaxy S/Note/Tab lines), just like Apple has with the iPhone, iPad, and iPod. They started an Ad campaign poking fun at Apple, just like Apple did with the Mac vs PC ads back in the day. Samsung owns most of their own supply chain to minimize production costs, while Apple relies on bulk purchases and promises of future business to drive down prices in their supply chain (they both also use Foxconn for some of their manufacturing).
Everyone else in the smartphone and tablet market is struggling. Some are making money, but its pennies by comparison to Apple or Samsung.