I think it depends on the office. State offices may prohibit it if that what their constitution says but running for president is spelled out in the US constitution.
Basically just be a natural citizen 35+ who has lived in the US for the last 14 yrs.
Technically you could be in prison, win and I guess be president from there.
But we're charting new territory no one anticipated.