I suppose it's possible they figured out a way to get away with it but it sure sounds like entrapment to me:
What they noticed was that the maximum penalty for selling a firearm to a convicted felon was the same as that for being a felon in possession, 10 years in prison. So they enlisted a confidential informer with a felony record to start buying guns from gang members.