Samsung is "right" to use such commercial. Ok, now I don't mean "right" as in law terms, but as in terms of marketing.
The success of Samsung can to some extent be attributed to the recognition they got as a iPhone alternative. When people ask what alternatives do they have for iPhone, Galaxy S-series phones come to mind. One thing to note here is that those youtube "barista" commercials and these iPhone comparison was meant only for US, not for rest of the world. You may want to look at the reason for this. US is the "hometurf" for Apple. Everywhere else in the world, Samsung is the clear market leader. Samsung is till the underdog in US as Apple has been able to get the attention of major part of the population. Samsung needs attention of the common people in US to increase their sales. This straight comparison is a method of sending a message to customers that there are devices apart from Apple which are just as good. And this is doing exactly what they expected. This is generating news, getting page hits and creating a buzz or a controversy.
In terms of objective, this ad managed to do what is expected - raise customer awareness about Samsung product. Corporates love this. Fanboy-ish fight in the forums is least of Samsung's concern...