In interpreting the terms of a contract of suretyship, the same rules are to be observed as in the case of other contracts. Except as provided in section 2794, the position of a surety to whom consideration moves is the same as that of one who is gratuitous.