CHICAGO, June 23 (Reuters) - CME Group feeder cattle contracts rallied on Friday, their second day of gains, as weakening corn prices cut into feed costs and boosted profit margins at packers.

Hog futures were weaker on follow-through selling after Thursday's sharp decline.

The August CME feeder cattle contract gained 3.275 cents to 233.95 cents per pound, rising above its 40-day moving average. The contract closed off its session peak of 235.15 cents after facing resistance as it neared its 30-day moving average.

CME's benchmark August live cattle contract settled down 0.375 cent at 170.775 cents per pound, settling below its 20-day moving average.

CME July hogs fell 0.575 cent to 91.275 cents per pound. Most-active August hogs dipped 0.3 cent to close at 89.675 cents a pound.

The U.S. Agriculture Department on Friday morning said that export sales of beef totaled 13,300 metric tons in the week ended June 15, up slightly from the 13,000 metric tons reported a week earlier.

Pork export sales rose to 28,700 metric tons from 26,700 metric tons.

After the close, USDA said that the number of cattle on feed as of June 1 stood at 97.0% of a year earlier. Analysts had been expecting 96.8%.

The amount of cattle placed on feed during May was 105.0% of the May 2022 total. That compares with market forecasts for 101.7%.

Cattle marketed during May was 102.0% of the year earlier total, above expectations for 101.6%. (Reporting by Mark Weinraub; Editing by Maju Samuel)