The Bible is explicitly clear that Ziba was opportunistically kind to David and unkind to his master, Mephibosheth. But you can't find that perspective in THIS chapter. One must consult II Samuel 19:24- 30 to discover Ziba's motives. In this context we not only see the actions Ziba, but also treachery of Shimei and Ahithophel. Now, Ziba actually brought a significant amount of food to David, but as I said, we will learn later that he was setting himself up to move from servant to master. He not only brought supplies, he brought lies; lies about his master Mephibosheth.
If David had been at the top of his game, so to speak, perhaps he would have picked up on the lying strategy that Ziba was employing. Why would Mephibosheth have thought that a struggle between David and Absalom would have produced an opportunity for him to become king? But, David was at the bottom. I mean, he was just about as low as you can get. Not only had his son and his chief advisor turned on him: he was temporarily homeless, he had lost the loyalty of many of his people, he thought Mephibosheth was ungrateful for the kindnesses that had been shown to him, he was journeying further and further away from the house of God, he had reasons to reflect on his checkered past with deep angst, and on top of that there was this guy, Shimei, who pestered David and his traveling party mercilessly, throwing rocks and cursing. It was bad enough that Joab's brother asked David for permission to go decapitate the jerk. But, David refused to allow it.