I don't know whether or not it is legal, but I have seen an electric car with tram whiskers before. I think I saw it in San Francisco, and I think it was a Prius. Some quick Googling fails to turn it up, though.
EDIT Found a link: https://thebolditalic.com/hacked-prius-running-on-muni-power...