The fight apparently started with a dispute between two inmates and other prisoners joined in, creating a melee that lasted until authorities retook control of the facility in Matamoros, which sits across the border from Brownsville, Texas.
A statement from state public security department in Tamaulipas, where Matamoros is located, said officials were notifying the families of those killed and injured. It said there would be an investigation.
The violence lasted from about 8 a.m. to 10:30 a.m. local time before soldiers and marines took control, according to a state official who was not authorized to comment.
The violence comes as Mexican prison conditions have been under increased scrutiny because of violence and escapes.
On Thursday, a fight between gang members at a prison outside Monterrey left seven inmates dead. In July, a riot in a prison in the border city of Juarez killed 17 inmates.
Gangs and drug cartels often dispute for control of prisons in Mexico, which also suffer a high level of corruption.