First, to answer your question directly: It's not at all illegal for your agent to give you a rebate at closing.
That being said... let's get real.... For the sales person to offer that behind your agent's back is both unethical, and really bad business. Especially if that builder's rep knows you are currently working with an agent. If the builder were to find out about that, they would likely be fired for it.
What he is trying to do is get his wife to get a free 3% commission from the sale of the home behind the builder's back. As a bribe for your cooparation, he is offering you a $1500 kickback.
I would really love to know who this sales person is. That kind of back handed behavior is what drives people to look at Realtors and Builder reps as little more than used car salesmen, when in realtiy, a solid buyers agent is worth their weight in gold.
A solid buyer's agent can get you a better price, better incentives, and better financing. They can watch your back on every aspect of the sales process, and help you with inspections and repairs. Prices for the homes do not change if you have a buyers agent or not, so it does not cost a penny to have a good agent helping you and making sure you are getting the very best deal possible.
Stories like this one make me a bit ill.
What people always forget is the many hours a Realtor spends finding you homes, helping you to narrow them down, spending their time and gas to show them to you, guiding you with their experience and educating you on the market, financing, and what the best options are. When a home is finally found, they are paid in the back end. What people don't see is all the hard work it takes to finally get that point.. Your agent deserves to pay their bills like every one else.
Its like you going to work for 40 hours, and when payday comes, someone offers your boss a little kickback if they send your paycheck to someone else.. Likely, you would be up in arms and ready to sue your employer back to the stone ages... But this is exactly what this rep is trying to do..
Not only would I stick with your current agent, but I would inform the builder of this Reps actions, and ask them to give you the extra $1500 off the price or towards your closing costs, or a free upgrade. Your agent should make their full 3%.. This buillder rep made a huge ethical mistake by trying to steal from your agent, and from the builder. This kind of thing should not be allowed to happen and should be stopped at all costs. Let's keep honest people honest... Just my 2 cents.
On a side note.. DON'T DEAL WITH THAT SALES PERSON ANY LONGER! If he tried to lie about this and cheat and steal... what else is going on that you can't see? Call the builder and request a different sales person handle your home purchase, and be sure your agent is there to make sure your butt is covered.