Other members were able to activate an emergency beacon and the group was rescued on Sunday morning by the Alaska Air National Guard, the troopers said.
While Berg and Gottsegen were the most severely mauled, two other students, 16-year-old Noah Allaire of Albuquerque and 18-year-old Victor Martin of Richmond, California, also were hospitalized with injuries.
Martin was released late Sunday but the other three remained hospitalized. Their conditions were not available.
The three other teens received minor injuries or suffered from exposure-related ailments, the troopers said.
The students were on the 24th day of a 30-day backpacking trek through the Alaska wilderness as part of the National Outdoor Leadership School.
The bear was a sow that appeared to be guarding a cub, said Don Ford, the outdoor school's Alaska director.
"They believe there was a cub," Ford said. "They didn't actually see the cub, but they saw some rustling in the brush."
The seven students were part of a larger group that included three instructors, the school said in a statement.
Ford said the entire expedition was terminated and the remaining students and instructors were being flown back to the school's Alaska headquarters.
The school has never before had a bear maul any of its Alaska expedition members, Ford said.
"This is our 40th year of operation in Alaska. We have not had a bear attack in all of that 40 years," he said.
The National Outdoor Leadership School, based in Lander, Wyoming, is a non-profit educational organization that conducts expeditions and instructional courses around the world.
(Editing by Dan Whitcomb)