There are certain exceptions: a player does not receive an RBI if he hits into a double play, if an error is charged on the play, if a run is scored on a wild pitch or passed ball, or if the pitcher balks. A player does receive an RBI for a walk or hit by pitch with the bases loaded.
As an example, if a player hit a home run with two runners on base, the batter would get three RBIs (since both baserunners as well as the batter would score).
RBIs are sometimes referred to in slang, as ribbies or ribs, by interchanging the B and I.