  The present paper is devoted to the problem of (local) geodesic equivalence
of Riemannian metrics and sub-Riemannian metrics on generic corank 1
distributions. Using Pontryagin Maximum Principle, we treat Riemannian and
sub-Riemannian cases in an unified way and obtain some algebraic necessary
conditions for the geodesic equivalence of (sub-)Riemannian metrics. In this
way first we obtain a new elementary proof of classical Levi-Civita's Theorem
about the classification of all Riemannian geodesically equivalent metrics in a
neighborhood of so-called regular (stable) point w.r.t. these metrics. Secondly
we prove that sub-Riemannian metrics on contact distributions are geodesically
equivalent iff they are constantly proportional. Then we describe all
geodesically equivalent sub-Riemannian metrics on quasi-contact distributions.
Finally we make the classification of all pairs of geodesically equivalent
Riemannian metrics on a surface, which proportional in an isolated point. This
is the simplest case, which was not covered by Levi-Civita's Theorem.
