Although at times there is an etiquette (or unwritten rules of conduct if you will) on acceptable behavior, and when there is a breakaway it is frowned upon to not take your turn up front and help, there is nothing preventing an individual or entire teams from choosing to stay back and not exert themselves by taking point.
However, there are a couple of possible negatives for doing so.
First, they may find themselves out of position (too far back, blocked in, etc.) should an attack from the front occur. This will then require greater effort from the individual/team to work their way back onto the wheel of the attackers.
Second, it is allowing the team up front to set the tempo. Like with all endurance sports, individuals tend to be comfortable at different tempo's. A different tempo than what is comfortable makes it harder to react to changes in the tempo. This is why you will often find all the members of a team up front on some stages really cranking it out while allowing their team leader to sit right behind them. They are setting a quick tempo to discourage attacks (hard to attack when you are needing to work hard to maintain the current pace) and also to leave their team leader in a perfect position to follow any attacks if warranted.
So to answer your question, it is all a matter of strategy.