No, it is not true. Period.It simply IS true. Dealerships charge the customer a markup on parts that they get from the manufacturer for non-warranty repairs, a lot of the profit in a repair comes from the mark up on parts. On a warranty repair the dealership is not purchasing a part from GM and then selling it back to GM with a markup in order to do the warranty repair... they just get the part for free and charge GM for the labor.
Let's look at a typical law - one from Washington state:
Their law says (the bold print was added by me):
Each manufacturer shall provide each of its dealers with a schedule of compensation to be paid to the dealer for any warranty work or service, including parts, labor, and diagnostic work, required of the dealer by the manufacturer in connection with the manufacturer's products. The schedule of compensation must not be less than the rates charged by the dealer for similar service to retail customers for nonwarranty service and repairs, and must not be less than the schedule of compensation for an existing dealer as of June 10, 2010.
The rates charged by the dealer for nonwarranty service or work for parts means the price paid by the dealer for those parts, including all shipping and other charges, increased by the franchisee's average percentage markup. A dealer must establish and declare the dealer's average percentage markup by submitting to the manufacturer one hundred sequential customer-paid service repair orders or ninety days of customer-paid service repair orders, whichever is less, covering repairs made no more than one hundred eighty days before the submission.
A copy can be found here: RCW 46.96.105: Warranty work.
Just about every other state has a similar law.
Short version: The dealership gets paid retail rate for parts when they perform warranty work.