You use "leave it with me" if you are taking possession of something. If a package arrives at your house for your parent, you can tell the deliveryman "You can leave it with me" and he will give it to you. If you have to hand in your homework but the teacher isn't there, the assistant can say "Leave it with me" and she will take your homework.
You use "leave it to me" if you are taking on a new responsibility. If your friends are planning a party and they ask who will bring a cake, you can say "leave it to me" if you will bring it. If your roommate is too busy to wash the dishes, you can say "leave it to me" if you will wash them.