James Potter threw away the cash from his crime as police moved in to detain him.
A judge told Potter at the High Court in Edinburgh: “Although you claim to have no memory, this was a premeditated attack which must have been terrifying for your victims.”
“They could not have known the gun you presented was not real,” said Lady Wolffe.
She told Potter: “I am satisfied, in your case there is no alternative disposal to one of imprisonment.”
The judge said he would have faced a five-year sentence, but for his guilty plea. He was also placed under supervision for a further year.
Potter walked up to Steven Collins as he sat in his car with the evening’s takings and pointed an imitation handgun at his face.
He told Mr Collins, 24: “I’ll be taking that. Do you think this is no real?”
The court heard that the delivery driver formed the impression that he was faced with a real firearm.
Advocate depute Alex Prentice QC earlier told the court that Mr Collins was concerned for his safety and that of his girlfriend who was with him and handed over £175.
Unemployed Potter, 27, then told his victim: “That’s not it all.”
But Mr Collins showed him that other items he was holding were receipts and Potter headed off.
The victim’s partner called police who were given a description of the robber following the incident in High Street, Prestonpans, in East Lothian.
Mr Prentice said police traced Potter shortly afterwards and he was seen to throw something into the garden of a house.
Potter was detained and the discarded item was recovered and found to be the £175 proceeds of the robbery.
The fake firearm was discovered to be a child’s cap gun.
Potter, who has previous convictions including assault and possession of an offensive weapon, previously admitted assaulting and robbing Mr Collins on October 11 last year by presenting an imitation handgun at him while on bail.
The court heard that Mr Collins worked as a part-time delivery driver for a Chinese takeaway restaurant in Prestonpans.
On the night of the robbery Potter had earlier approached his car which his girlfriend was sitting in and asked her for a lighter which he returned.
After he had made several deliveries Mr Collins had returned to the High Street and was getting ready to cash up for the night when Potter struck.
Potter, who has worked as a delivery driver, had gone out drinking and had taken street drugs after having an argument with his partner, defence counsel Matt Jackson said.
He added: “He speculates he must have got the weapon that was used from the home of a friend,” he said.