(TMZ) Jared Fogle is treated like royalty by fellow child molesters in prison, and that's why he got the crap beat out of him ... so says the inmate who handed out the beating.

Steve Nigg -- the 61-year-old who attacked Jared last year in a Colorado prison -- wrote a letter, obtained by TMZ, saying Jared was disgustingly revered as an almighty figure among pedophiles in prison.

In the letter, Nigg says "Jared is their hero," and "You would not believe how arrogant Jared was. He hired bodyguards and the other child molesters looked at him as if he was a god." That changed, briefly at least, when Nigg left Fogle with a bloody nose, swollen faceand scratches on his neck.

Fogle's doing 15 years for child porn and crossing state lines to pay for sex with minors.

As we reported ... Nigg ultimately was moved to an Oklahoma prison. Nigg says he's since "lost good times (time off his sentence) and spent many months in the hole, plus the loss of commissary and email."

Still, he says ... "I have no regrets."