The court found he sold low-quality products that were not of pharmaceutical standard, risking the health of his customers.
Townshend tried to keep himself at arm's length by using other people's bank accounts and registering websites and Facebook pages under false names.
The Ministry of Health was aware of his activities, the court heard. It gave him a verbal warning - which he ignored - in March 2013.
Townshend pleaded guilty to 129 breaches of the Medicines Act 1981, including possession, advertising and sale of anabolic steroids, clenbuterol, and related medicines illegally used for sports performance and image enhancement.
He was sentenced today in Christchurch District Court for advertising, possessing and supplying prescription medicines.
"Townshend put the public's health at risk by supplying prescription medicines outside the regulatory system," Medsafe compliance manager Derek Fitzgerald said.
"That system was put in place to protect the public by assuring medicines met appropriate levels of safety, efficacy and quality."
Anabolic steroids can cause stunted growth and contribute to heart and kidney failure, according to the Ministry of Health.
They can also cause women to develop masculine traits and in high doses users risk liver tumours and mental disorders.
Fitzgerald said anyone who had used medicines from clenbuterol.co.nz or other black market steroids should get advice from their GP.