The cops broke the law. The dealer sold it to the cop. The dealer even sounds like he said no at first if it was for the 18 year old.
It's not entrapment. It's a failed attempt at entrapment. For entrapment to exist the defendant must actually commit a crime. Here, the police couldn't even get him to commit a crime, but still charged him.