Confessions had been forced from the Muslim men after they were beaten up in custody, a rights activist said.
They were among a group of people arrested late last year.
Homosexual acts are illegal in the West African state under both Islamic and secular law - the latter was tightened earlier this year.
Same-sex marriages, gay groups and shows of same-sex public affection are now banned throughout Nigeria.
Another Muslim man also received 20 lashes in January after the Islamic court in Bauchi convicted him of homosexual offences.
Most states in the predominantly Muslim north of Nigeria have adopted Islamic law, known as Sharia, since the end of military rule in 1999.
The BBC's Ishaq Khalid in Bauchi says details about the latest case are sketchy, but court officials have confirmed the whippings.
It seems the court wanted to avoid publicity after an angry crowd disrupted proceedings last month, demanding the death sentence for the four, our reporter says.
The judge did not impose the death penalty because the homosexual offences had taken place a long time ago, and the men had repented, he says.
Where is it illegal to be gay?
The men, aged between 20 and 22, were also ordered to pay a fine of $120 (Â£70) each, Dorothy Aken'Ova, a rights activist with the Nigeria-based International Centre for Reproductive Health and Sexual Rights, told the Associated Press news agency.
Rights groups were trying to raise the money - otherwise, they will remain in prison, she said.
The men should not have been convicted because they were beaten up and their confessions forced, she said.
Their families, mainly subsistence farmers, turned down an offer of legal representation because they preferred to negotiate with the judge and get the case behind them, Ms Aken'Ova said.
Nigeria is a deeply conservative country, where most people - Christian and Muslim - are opposed to homosexuality.

Media playback is not supported on this device
Muir told BBC Scotland her veterinary medicine studies will mean she will not be with the Scotland team at next year's event on Australia's Gold Coast.
The 24-year-old finished fourth and sixth in the 1500m and 5,000m at the World Athletics Championships.
"My exams aren't until May so Commonwealths being in April, it's just not going to work out unfortunately," said the middle distance runner.
"I go back to university next week. I've got a week off then back to my studies to complete my final year.
Media playback is not supported on this device
"I love running for Scotland whenever I can and the Commonwealths are one of the few opportunities you can do it so, yeah, I'm gutted I'm going to be missing it.
"But you have to think about getting my degree and that was really important to me. I'm sure the team's going to do so, so well. They're going to do great.
"I think I've got at least two, even three more Olympics in me. What events? I don't know. Certainly, so much scope for the future."
However, Muir says the World Indoor Championships in March are "potentially a target".
"These next few months are going to be very full on with my studies," she explained.
"I feel like I'm in reasonable shape. I'd like to run in Birmingham."
Hellen Obiri upset defending world champion Almaz Ayana to win 5,000m gold in London, with Sifan Hassan third.
Muir's time of 14 minutes 52.07 seconds was her new outdoor personal best.
"I'm really happy," she said after Sunday's race.
"It was really tough competition out there. I'm delighted with that. I'm really, really pleased with how I ran.
"My fifth race in 10 days - it's a lot of running and to still come away with that I think there's a lot of potential for the future."

A National Records of Scotland report said the Dumfries and Galloway village remained a "popular venue".
There were 3,511 marriages registered in 2015 compared with 3,499 in 2014.
However, last year's total is more than a third down on the record total for Gretna which dates back to 2004 when there were 5,555 weddings.
Nonetheless, it can still claim to be the "marriage capital" of Scotland and accounts for 12% of all weddings.
It is particularly popular for "tourism marriages" and some 84% of the weddings held in Gretna last year did not involve a resident in Scotland.
Four Nigerian men have received 20 lashes each after an Islamic court in the northern city of Bauchi convicted them of gay sex, officials say.
[NEXT_CONCEPT]
Laura Muir says she'll be "gutted" to miss April's Commonwealth Games.
[NEXT_CONCEPT]
The number of marriages in Gretna topped 3,500 last year - a slight rise compared with the previous 12 months.