In Indonésia, when you stay more than 24 or 48 hours at someone's place, you have to register to some authority (not exactly the police, but I forgot the official name).
This is not only foreigners. The police just want to keep track of people (or at least, pretend they do)
You don't need to tell them anything. Just give your ID and the address you'll stay at.
They will ask you plenty of question that you may find nosy, but that's mostly Indonesian chit-chat.
You don't have to pay anything, but Indonesian official being what they are, you possibly will have to. You know... just being polite with the elders :-/ .
Let your local friend deal with this part. It's easy to accidentally insult people by giving/not giving money to the right/wrong person.