Selectivity of m-CPBA
The transformation taking place in your question is a name reaction known as a Baeyer-Villiger. 

The Baeyer-Villager transforms ketones into esters/lactones (cyclic esters) via an alkyl migration in which the group most able to stabilise a positive charge is observed to migrate. 

A general mechanism is presented below (taken from the wonderful name reactions book cited). The key steps are (1) attack of the peroxide into the carbonyl followed by (2) the alkyl migration to form the ester grouping. 


Source: Strategic Applications of Name Reactions, 2005.