Not outright illegal, but in some places it's often required that what you're seeing is clearly an advert, or contains advertising.
For example, a watermark or logo is shown at the start of a broadcast containing product placement in the UK. Prior to 2011, it was 'forbidden' for broadcasters entirely. (Quotes because you could still broadcast films that may arguably have it)