Until it's caught, the fowler's whistle sounds sweet to the bird.

Literal

Caught [until-まで], bird [to-には] birdcatcher [gen-の] whistle [subject-が] good sound [as-に] is-heard.

A proverb with a classical feel. 捕らえられる is the passive of 捕らえる ('catch, capture'). ~まで marks the temporal limit ('until X'). ~に聞こえる is 'sounds like X,' where に marks the resulting category. The structure 'to the bird, it sounds good' puts the experiencer (鳥) in the には composite particle slot, a pattern used when someone perceives something. The moral: what seems pleasant can be deadly.