Ignoring any ethical concerns you may have...
Advertising has often been comparing yourself to other brands. As one real world example: The Pepsi Challenge from the 80s. People drank Coke and Pepsi blindly and chose which one they liked better.
It is not illegal in the US and not inherently a misuse of trademark law. I'd be surprised if you were to tell me that Uber and Lyft are not buying ads against each other's search terms.