It is a decision which will ultimately be made by the local authorities. You may ask for anything and you might even get it. But, a lot depends on why you were refused entry:
1. Inadequate docs - You become the responsibility of the delivering carrier. It is stuck with the cost of returning you to your origin, as well as local security costs and potentially a quite significant fine. It may recover all of those from the passenger.
2. Adequate docs but otherwise denied entry - You are the government's responsibility. It must make arrangements for you. If you are prepared to pay for transport to some place other than origin, you might find a local bureaucrat quite happy.
But, for planning purposes --- if you are worried about what will happen, count on being sent back to XXX if that is where your flight arrived from.