Most big food brands will not allow supermarkets to use their recipes, so the idea that branded products are the same is not strictly true. A non-recipe product such as frozen veg might be the same, but things like chips or (even more so) ready meals are absolutely not.
What is true, however, is that the main difference is advertising. There is no inherent reason why Brand Beans are better than Supermarket Beans, but we are probably more used to their taste, and have been told since childhood that they are the best.
When it comes to non-food goods, such as drugs, the difference is stark. Generic ibuprofen, for instance, in places like Home Bargains is about 37p a pack, whereas the 'Leading Brand' is £2.99. The active ingredient is identical, and is even printed on the pack, but some people still insist that the branded one is better, which shows the power of advertising.