Going through customs does not make something legal to buy or possess.
Customs is a spot-check that doesn’t catch everything and Customs cannot possibly verify every single product’s legality.
Many people buy illegal drugs internationally and just hope they get through customs, for example. That doesn’t make it legal.