Dalton Travers, from Great Barr, was locked up for five years after a police operation earlier this year.
West Midlands Police said officers acted on information and discovered the gun and ammunition at an address associated with Travers in Sutton Coldfield in September.
Officers also found CS spray, more than £7,000 in cash and more than 20 cannabis plants after swooping on his home address in Aldridge Road, Great Barr.
The 19-year-old pleaded guilty to possession of a prohibited firearm, weapon and being concerned in the supply of Class B drugs.
He was sentenced at Birmingham Crown Court.
Det Con Louise Davies, from West Midlands Police CID, said: "This was a dangerous weapon we’ve managed to take out of circulation. We know the harm they can cause within our communities when in the wrong hands.
“Travers was also connected to drugs and has now lost his freedom as a result of his criminal actions."