Yes it is Legal! Bidding on trademarked PPC keywords are the highest converting Pay Per Click terms you can bid on. These are buyers keywords and have huge ROI. BUT, you should follow these Pay Per Click guidelines when bidding on trademarked PPC keywords.
1) Do NOT bid on trademarked keywords if you are promoting the same brand as an affiliate.
2) Do NOT use the trademarked or brand keywords in your advertisement copy: title, description, or URL. This rule applies to banner advertisements too.
3) Always ask your affiliate manager or marketing manager for confirmation before running PPC advertisements on trademarked terms.
Preferably, if you are a competitor or an affiliate , you CAN be bidding on the trademarked brand keywords.
The search engine journal article: