You can't really say "the hotel is inside walking distance" and 'my family is within my home' sounds wrong. So these are cases where 'within' and 'inside' are not synonymous. But in many cases, they can be used interchangeably, though 'within' has a more poetic flavor to it:
* "Who knew what horrors lay within the castle walls?" You could just as well say "inside the castle walls" here, but you'd miss out on the alliteration with "who" and "walls"
* "Open the box and discover the treasures within." Again, you could use "inside", but the poetic "within" heightens the magic of "treasures"