"I can't drink milk, but I can drink soy milk."
Is that what you tried to use instead of 可以? Because 不能 would imply that you are physically incapable of drinking the milk, like you're a quadriplegic or maybe your milk is gone or placed behind a force field, thus making the action impossible to perform. From the sentence, it is implied that you are physically capable of drinking since you can have the soy milk, thus the action is not obstructed and you can't say "不能“. The real sense here is that the speaker is not allowed, or mustn't drink the milk. Not that they are unable to do it. (Even if they have a serious allergy)
Sort of like if you were at school and you asked if you can use the restroom, and the teacher responds "I don't know, CAN you?". Instead expecting you to say "MAY I use the restroom?"
you can be lactose intolerant and therefore unable to digest milk, and by extension, drink milk. I think that is a physical inability. The line between the two "can" is blurred here.
Examples from Youdao to reinforce my case:
In each case the person is "able" to drink the substance, but won’t because it’d be bad for him.