As said, vehicle manufacturers are bound to do things in a very closely specified way. I've been involved in vehicle engineering with various manufacturers and for example emission tests are done in accordance with very closely specified procedures, for example vehicle pre-conditioning and soak times/temps etc before the test is carried out.
Like any business, manufacturers will try to present their product as best they can, and in terms of emissions that means being able to sell cars at all (no compliance, no certificate, no sales) and for fuel economy (CO2) that puts the products into various tax categories etc which can have significant influence on market sales.
For economy, what you can and can't do to a vehicle to prepare it for test is laid down, things like tyre wear etc (rolling resistance). Stuff used to be done which was stretching the regs to the limit (alternator pulley diameters anyone?), but largely stopped now.
Manufacturers have had to do economy tests in accordance with the regs, the fact that it hasn't historically represented real world conditions is not down to the manufacturers. That has changed largely now with the "real world" test cycles, but that is strictly specified too.
Whether an on-board trrip computer is realistic or not is nothing to do with regs however, that's up to the manufacturer. There's little excuse for being wildly wrong on those, anything more than 10% optimistic is not really forgivable.
If you don't like the regulations, blame the regulators not the manufacturers.
Using any means to deliberately make a vehicle run differently during conditions not represented by emission certification testing has always been illegal, the so called "defeat device" ("device" is a legalese term meaning any means by which it is done, it doesn't mean a specific physical object). One of the first things drummed into us when I started in the industry was that you DO NOT do anything which could be interpreted as a defeat device. Any manufacturer who has deliberately done this deserves all the penalties they get, they know what they are doing and they know defeat devices are illegal.
One major factor which influences real world economy is the wind, which is often not appreciated. Drive with a 20mph tail wind and the economy will be very much better than driving into a 20mph head wind.
Heavy rain too, look at the spray coming off wheels and think what is powering that, you need a decent pump to shift that much water and that pump takes power.