Makhloufi had already qualified for Tuesday's 1,500 final, where he was a likely medal contender, when he stopped running in the first lap of his 800 heat.
The race referee ruled that the 24-year-old African champion in the 800 was guilty of "failure to compete honestly with bona fide effort" but the Algerian federation insisted he had a knee problem and that organizers knew about it.
After assessing evidence of a games medical officer, the disqualification was revoked and the runner can compete in the 1,500 final.
The head of Algeria's athletics federation said the team felt "really hard done by in this incident" before the ruling was overturned because Makhloufi's injury was genuine.
"He respected everybody in the race he was in. He presented himself to the race officials," Bahreddine Belhadjoudja told The Associated Press by telephone from Algeria.
Belhadjoudja acknowledged that Makhloufi, who is the African champion over 800, had prioritized the 1,500 for the Olympics. He had already won his heat and semifinal in the longer event.
"He had a pain in his knee and wanted to save himself for the final," Belhadjoudja told the AP.
The IAAF reinstated the runner for Tuesday's medal race "after reviewing evidence" from a medical officer.
The 24-year-old runner's case was the latest controversy around not playing to win at the London Games, but this time, the decision was revoked.
Last week, four women's badminton doubles teams from China, Indonesia and South Korea were disqualified for playing to lose in order to manipulate who they would play against in the next round.
The coach of Japan's women's football team escaped sanction from FIFA and the International Olympic Committee after acknowledging that he instructed his team not to win a group match in order to influence in which city the team's quarterfinal would be played.