The relative elevations of the launch point and target do make a difference to the angle required for maximum horizontal range, but only in the real world, admittedly, not a theoretically perfect one.
Also, even on level ground, although the theoretical angle for best range is 45 degrees, it isn't so in reality. Actually, a few degrees lower than the 45 will achieve the best range.
I admit I've forgotten the details, but I believe it's basically down to air resistance slowing the projectile, so it's velocity is higher at the start of the arc then the end. IE the projectile's arc isn't symmetrical.