"walking by the river" means "walking nearby or next to" the river- here, 'by' is being used to indicate relative location. Other examples: "he put the keys by the door", "I live by the forest"
"go by plane" means that you are traveling on the plane; 'by' is being used to indicate the method you are using to do something (to go). Other examples: "I will talk to her by phone", "You open the door by turning the handle"