Khylon Brooks was caught with the device when officers at the prison in Leeds searched his cell on April 1 last year.
Andrew Horton, prosecuting, told Leeds Crown Court Brooks was mumbling when the officers spoke to him.
They then noticed something was in his mouth and he spat out a phone into the palm of one the officer's hands.
An improvised charger for the device was found behind a television on a desk in the cell.
Mr Horton said it was an 'old style' mobile phone that was unable to access the internet.
The governor at HMP Leeds provided a statement to the court describing how mobile phones caused major disruption within prison.
Brooks, 22, of Edgerton Road, Huddersfield, pleaded guilty to possessing a prohibited item inside a prison
The court heard Brooks had been serving a 16-month sentence at the time of the incident for an offence of affay.
Probation officer Kerrie Wilson said Brooks had the phone because he was worried about his family and his partner and wanted to stay in contact with them.
She said Brooks' partner is expecting first child in May this year and he was motivated to stay out of trouble.
Ms Wilson said the defendant had been doing a business course since being released from custody.
She added: "He said his previous behaviour had been linked to gang affiliations."
Peter Byrne, mitigating, said Brooks had pleaded guilty to the offence at an early stage.
Mr Byrne urged judge Simon Phillips, QC, to suspend any prison sentence to give Brooks the opportunity to prove he is able to stay out of trouble.
The judge said the offence was too serious to impose anything other then an immediate custodial sentence.
Brooks was returned to prison for eight months
He said: " They (Mobile phones) are a serious risk to the good order of the prison and safety of the staff and prisoners.
"They are a major ongoing issue."