This is true for bell peppers up to a point. There are many varieties of peppers, and obviously some have different characteristics including taste. And as they fully mature some varieties may turn red, some yellow and some orange. Though I believe some varieties never change color too. And like many other fruits and vegetables, allowing them to ripen fully can change the sweetness. I would also assume that varieties that do turn a nice red color are often the varieties allowed to go to that stage for maximum eye appeal in the store, and they may not be the same variety as the green, as that one may have been selected for another characteristic, like quicker fruit formation. So the green pepper may be quite different from the red pepper in the bin next to it at the store.