Brake lights do not work when tail lights are on?

On a toyota tacoma 2003 SR5 when the tail lights are turned on the brake lights come on and when the tail lights are of the brake lights work just fine what could be the problem.

If the truck has a trailer plug, inspect the plug and plug wiring for damage and corrosion.