AT&T will know you are using an iPhone with the incorrect plan the instant you connect to their network. Also the SIM card that will come with the Samsung will not work with the iPhone, you either need to have the one that was originally in the iPhone or get a brand new one from AT&T.
If you do get it working AT&T will start sending you messages that you have an iPhone and an incorrect data plan. After some time they will cut you off until you get the right plan.
Being that you are getting the iPhone from a friend you might as well just save yourself the hassle and set it up correctly. You shouldn't have to sign a contract since you are not getting a discounted phone, where as with that Samsung I'm assuming that's with contract.