Many in the final stages, especially those in hospice care, are on large doses of morphine just in order to be comfortable. And when you are on morphine, you have little to no appetite at all.
Many years ago when I had my motorcycle accident and broke both legs and dislocated shoulder, I was on heavy morphine practically around the clock. And had lost my appetite completely. I would get thirsty, but had zero appetite for food. Way worse for someone who has cancer, as the cancer itself is eating you from the inside and destroying your organs natural abilities to function properly.