Technically, I suspect at least some states probably have some sort of motor vehicle regulation prohibiting brake checks for no reason. However, I love small animals so I always brake for mice in the road ... I don't think any state prohibits applying the brakes to avoid hitting wildlife. Too bad if the person behind was following so closely they didn't see it.
On the karmic level -- job well done. You definitely get extra points for the coffee cup dousing the windscreen.
In recent years I have become wary of using that tactic, though. People today follow SO close and are so focused on everything except their driving that I fear using the brakes would only result in them rearranging the factory configuration of the after portion of my vehicle. Yes, it would be their fault and their insurance would have to repair it, but I can survive without dealing with that additional aggravation in my life. I should probably do what I did back in high school -- wire in an override circuit with a push button or toggle switch on the dashboard that flashes the brake lights without applying the brakes.
Or buy one of those scrolling display thingies for the rear window, and program it to read "BACK OFF!"