If the person dies of pneumonia due to COVID, it would be the underlying cause of death. Pneumonia would be the immediate (or intermediate) cause of death. At least, that's how I understand it from this CDC pamphlet.