Lochte, Gunnar Bentz, Jack Conger and Jimmy Feigen were stopped by people posing as armed police, the US Olympic Committee (USOC) said in a statement.
The robbers demanded money and other personal belongings.
After reports emerged of the incident, the USOC initially denied that Lochte had been robbed.
"All four athletes are safe and co-operating with authorities," the USOC's statement said.
The group had been attending a party at the French Olympic team's hospitality house when their taxi was stopped on the way back to the athletes' village.
News of the incident first emerged from Lochte's mother, Ileana, who told USA Today her son was unharmed but shaken by the theft.
"I think they're all shaken up. There were a few of them," she said.
Lochte swam in two events at the Rio Games, winning gold in the 4x200m freestyle relay.
In June, Australian paralympic athlete Liesl Tesch was robbed at gunpoint in Rio.