Another way to think of it is that 무료(無料) means there is no 요금(料金 - fee) or 급료(給料 - wage) payed.
So if you don't have to pay any fee or price, the item or service may be called 무료.
This will include most general services or merchandise commonly bought and sold.
For things that don't fall in the above category, you use 무상(無償).
These include specialized services or benefits that may not be available to the general public, and for which there is usually no set price, such as provided by the government or public institutions, or requiring pre-existing contracts, and so on.
So we have 무료 봉사(free volunteer service), 무료 상당(free consultation), and 무료 강습(free lesson) for 무료, and 무상 의무교육(free basic education by the government), 무상 급식(free school lunch), 무상 원조(gratuitous aid) for 무상. The latter are special types of services or benefits available often with strict eligibility requirements.
But as with anything, this distinction is not always very clear, so they may be interchangeable sometimes.