A man visiting his brother in prison was arrested after a sniffer dog found cannabis hidden in his underpants, a court was told.
Usman Bashir (18) of Hallam Street, Balsall Heath, was jailed for four months when he appeared at Stafford Crown Court.
He pleaded guilty to possessing cannabis with intent to supply during a visit to Featherstone Prison, near Cannock, Staffordshire, in February this year.
Saleem Mahmood, prosecuting, told Judge David McEvoy QC: "While visiting the prison and waiting in a queue he was picked out by a sniffer dog.
"He was taken to a room and searched and drugs hidden in his boxer shorts fell to the floor."
Mohammed Latif, defending, said: "No doubt he was under pressure from his brother, who was older. He deeply regrets putting himself in this position."