Starting in 6th generation, the Pokéball of the female Pokémon is passed down to its offspring.
Male and genderless Pokémon (including Ditto), instead, have no impact on the type of Pokéball inherited.
Has this mechanic changed in 7th generation?
According to Bulbapedia:
In 7th generation, if a male and female Pokémon of the same species are bred, the offspring will have an equal chance of inheriting either parent's Poké Ball.
Also, when breeding a male or genderless Pokémon with Ditto, the Poké Ball of the male or genderless Pokémon will now be passed down to its offspring.
Here's a summary: (Credits to Saiph-Charon)
For the purposes of inheriting Pokéballs, parents in a Master Ball or Cherish Ball are always treated as being in a standard Pokéball as before.