Boiling eggs in the shells traps the sulphur that is present in the yolk, which is why hard boiled eggs often have the grey coating around the yolk and why sulphur is often described as having a rotten egg smell. It's the trapped sulphur that often causes the gas and why scrambled eggs are usually easier on the stomach because the sulphur gas can be released as opposed to building up.