The prepositions в and на each have two meanings, which are distinguished by the case ending on the noun that follows. When an Accusative case follows, they mean motion (в 'in, into' and на 'on, onto'); when a Prepositional case follows, they mean location (в 'at, in' and на 'on'). That is one of the functions of the Prepositional case.
Acc. Ћн ходќл в библиотљку. (кудђ?) He went to the library. (where to?)
  Ћн положќл карандђш на бумђгу. (кудђ?) He put the pencil on the paper. (where to?)
Prep. Ћн бІл в библиотљке. (гдљ?) He was in the library. (where?)
  Карандђш лежќт на бумђге. (гдљ?) The pencil is lying on the paper. (where?)
The Prepositional case is also used after the preposition о 'about':
Ћн говорќл о библиотљке. He was talking about the library.