Six men passing themselves off as public servants delivering an inmate to the prison in Iguala in Geurrero state opened fire on inmates and guards, who returned fire, state prosecutors said.
Prosecutors issued a statement after the shootout saying they were considering whether prison officials may have abetted the attackers "by omission or participation," the Los Angeles Times reported.
The attack came two months after Mexican human-rights officials published a report indicating 65 of Mexico's 101 most crowded prisons are effectively being run by inmates, the newspaper said.
Prosecutors said the armed men, once inside the prison Friday, exchanged gunfire with six guards in a tower. Five of the attackers, along with four prisoners, were killed.
The sixth attacker and a prison guard were hospitalized.
State and federal authorities, as well as Mexican army forces, controlled the situation and restored order, the report said.
Prison reform has been an issue in each of Mexico's presidential elections since 2006, the Times said.