Actually I disagree with you here - to a point.
You are correct on this point.
The Posse Comitatus Act made it a federal crime to employ "any part of the Army or Air Force as a posse comitatus or otherwise to execute the laws." It was passed after the civil war to keep military forces from policing polling places in Southern states.
Much of it derives from the US Constitution in which (it was intended) most of the power within the United STATES remain within the States. If I remember correctly, there was a huge dispute in the War on Drugs about the use of the military in drug interdiction.
Regular Military forces are not trained to police. They are trained to help the enemies soldiers die for their country.