Eugene Debs, a Socialist leader in the early 20th century, ran for President five times. His fifth and highest vote count came in the 1920 Presidential election, in which he was running while in Federal prison for sedition. He received about 3.4% of the vote at the time (which included women for the first time since the Nineteenth Amendment was passed in 1920 as well). Not naming names, but yes, it’s possible to run for President while in prison, though results may vary.
So you can run for president in prison but you can’t vote when you’re in prison or have been in prison.
Hey America, you suck.
While I’d like voting rights to be more universal, there are 2 states+DC that allow voting from prison and 20 states where you immediately regain the right once you’re out of prison. A further 17 restore those rights when probation/parole is complete. The remaining 11 have a mixed bag of laws regarding the right.