Hundreds of millions of pounds paid in care home fees are not being used for frontline costs, a study suggests.