The reason the two statutes disagree is a frozen cross-reference, and it is the most citable fact on the subject. Internal Revenue Code section 529(e)(3)(B)(ii)(I) caps qualified room and board at the allowance for room and board included in the cost of attendance "(as defined in section 472 of the Higher Education Act of 1965 (20 U.S.C. 1087ll), as in effect on the date of the enactment of the Economic Growth and Tax Relief Reconciliation Act of 2001)." The parenthetical is what does the work. Section 529 does not track the current Higher Education Act; it references a specific historical version of it, the version in effect on June 7, 2001. When the 2020 FAFSA Simplification Act rewrote the cost of attendance definition and replaced the phrase, the change did not flow through to section 529. This is a deliberate static reference rather than legislative oversight, and it is why the vocabulary in a 529 distribution rule remains room and board even though the vocabulary on a current cost of attendance no longer is.
The cap has two limbs, and the second one is often overlooked. Under section 529(e)(3)(B)(ii) the eligible room-and-board amount is the greater of two figures. First, the allowance for room and board included in the college's cost of attendance as determined by the institution, referenced against the 2001 Higher Education Act definition. Second, for a student who lives in housing owned or operated by the institution, the actual invoice amount for that housing. So a student in a dormitory whose actual room bill exceeds the school's published allowance can spend the higher amount from a 529 without triggering a non-qualified distribution.
Half-time enrollment is a threshold rather than a formality. Section 529(e)(3)(B)(i) makes reasonable room-and-board costs a qualified higher education expense only for a student who is an eligible student as defined at Internal Revenue Code section 25A(b)(3), meaning enrolled at least half-time in a program leading to a recognized educational credential. A student below half-time enrollment cannot draw a tax-free 529 distribution for room and board even if the student is otherwise taking classes.
Pell Grants and other title IV aid used for room and board are taxable to the student. This is a separate rule from the 529 question. IRS Publication 970 treats need-based federal grants as scholarships for tax purposes, and a scholarship is tax free only to the extent it pays qualified education expenses, which the tax code defines to exclude room and board. So the portion of a Pell Grant that pays for housing and food is taxable income to the student, even though the money moves directly from the government to the school.
What is not resolved by any of this is what "reasonable" means. Section 529(e)(3)(B) allows only reasonable room-and-board costs, and the cap does the work of setting the outer bound. Below the cap the statute does not distinguish between food a student eats in a dining hall and food a student buys at a grocery store, or between rent on university housing and rent on an off-campus apartment. The distinction that does matter is the source of the number: an off-campus student cannot exceed the school's cost of attendance allowance, while an on-campus student can spend the actual invoice.