Do the includes before the AsExpandable like so:
var results = context.Set<T>()
foreach (var includeProperty in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
results = results.Include(includeProperty);
}
return results.AsExpandable.Where(where).ToList();