The sentence followed a one-day trial that one of the men dismissed as a "circus."
The four men, who were arrested in Kabul on 13 October, had faced prison terms of up to six years.
Prosecutors claimed the men had been caught trying to a sell 100 guns to an undercover police officer. The men denied the charges. One of them claimed police beat a confession out of him.
RFE/RL Afghanistan Report
SUBSCRIBE For regular news and analysis on Afghanistan by e-mail, subscribe to "RFE/RL Afghanistan Report."