Deputy judge Ko Wai-hung sent So Nga-yin and Henry Tse, both university students, and Chan Lok-sun, a freelance musician, to 10 weeks in prison each.
Lam Hin-shing, a 17-year-old secondary school student, was sent to a rehabilitation centre, and tertiary student Angie Lee was ordered to perform 240 hours of community service.
The five were arrested at the protest in Wan Chai on October 6, 2019.
They were acquitted of rioting, but four of them were convicted of breaching the mask ban and Lee pleaded guilty.
The ban came into effect a day earlier, on October 5.
Ko said the media had reported on the new law extensively, and it was impossible that the defendants had not been aware of the legal consequences of their action.