Because the government is barely in control of the capital city, let alone the country side. Last I heard the government had just arrived back to the country after years of exile and months on months (if not over a year) after the religious fanatics were kicked out of power by an Ethiopian invasion.
So the US/west is in a loose loose situation. Sure they can go in with full force, into a hostile area costing many many lives and maybe kill a few pirates, but it wont put them out of business. Only a brutal occupation can do that. What they in turn get are pissed off locals that will join forces with the "enemy of my enemy".. which is Al Q and the islamic extremists, and that is exactly what we dont want... rather have the pirates to be honest. Such action will also weaken the very very weak government in Somalia.. Now the government could ask for western assistance, but that would also weaken them considerably in the eyes of the very people that they want to trust them.. the Somalis, which in turn plays right into the hands of the religious extremists backed by Al Q.
Now the US/west can do what they are doing now, trying to fight off the pirates at sea, in international waters. However this plays bad to especially the gun hoarding shoot first ask questions never right wing of the right wing in many western countries. It also some what strengthens the pirates grip on the local population and in fact draws more and more into the pirate game, since it is profitable. It is also a propaganda coup to the pirates as we have seen, drawing more and more to the cause.
It is ironic that it was the islamic extremist AL Q backed government that kept the pirates down to a manageable size back in the day and since they are gone, the problem has exploded.
The US/west are damned if they do, damned if they dont.
And for the record.. Big Danish container ship is hard to "retake" from pirates, where as a small French yacht is a rather simple task, relatively speaking. The amount of space special forces have to cover to secure a ship of that size ... mind boggling. And there is plenty of places on a container ship where the pirates can set up kill zones and traps and in the end any time wasted means a bullet closer to a hostage head.
And it is not the first time the French have hit back at pirates in this way and they have zero tolerance plus the legal means.. as they are one of the nations that have universal jurisdiction on things like war crimes, crimes against humanity and high seas piracy.