Well, you can communicate directly with the computers on the same subnet only. For communication with computer in another subnet, the router/gateway is required.
Clear now?
Gateway is on the same subnet by definition. What the gateway not on the same subnet is good for ? Remember - you can't communicate directly with computer not on the same subnet ...